+ Reply to Thread
Results 1 to 12 of 12

If w/ Nested OR and AND driving me crazy

Hybrid View

  1. #1
    Registered User
    Join Date
    12-01-2016
    Location
    Denver
    MS-Off Ver
    Mac 2011
    Posts
    10

    If w/ Nested OR and AND driving me crazy

    I thought I had figured out how to use nested OR and AND with the IF function. I am trying to create a sheet to easily identify classes based on various test scores. There are various combinations that could qualify a student for a class; however, the formula is returning "Yes" for students whose scores do not meet criteria (see pics). I don't know what I am missing. Please help.

    MAT 121.png

    ENG 121.png

  2. #2
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,915

    Re: If w/ Nested OR and AND driving me crazy

    I think the AQ674 Contains a text value like space(" ")
    or got the value by using formula which is used "" to avoid errors
    Even though AQ674 is looking like blank cells actually it is not blank
    Samba

    Say thanks to those who have helped you by clicking Add Reputation star.

  3. #3
    Forum Contributor
    Join Date
    02-07-2013
    Location
    Karachi, Pakistan
    MS-Off Ver
    Excel 2007
    Posts
    290

    Re: If w/ Nested OR and AND driving me crazy

    Hi,

    Wrap your all cells with N, something like:

    =IF(OR(N(A1)>=23,N(B1)>=85,N(C1)>=500),"Yes","No")

    Regards,
    Khalid

  4. #4
    Forum Expert
    Join Date
    10-09-2014
    Location
    Newcastle, England
    MS-Off Ver
    2003 & 2013
    Posts
    1,986

    Re: If w/ Nested OR and AND driving me crazy

    Quote Originally Posted by Khalidngo View Post
    Hi,

    Wrap your all cells with N, something like:

    =IF(OR(N(A1)>=23,N(B1)>=85,N(C1)>=500),"Yes","No")

    Regards,
    Its important to remember though that when you use N() you make it far more difficult to spot errors and therefore can end up with incorrect results

    eg the formula:


    =IF((A1*B1*C1/D1) < 10, TRUE,FALSE)

    used against
    A1 = 2
    B1 = 3
    C1 = 4
    D1 = 5

    returns TRUE

    IF however C1 was "A" then it would return
    #VALUE

    If you use
    =IF((N(A1)*N(B1)*N(C1)/N(D1)) < 10, TRUE,FALSE)

    however that would also return TRUE so it would be difficult to spot a problem (especially if the data is elsewhere and not in general view).
    If someone has helped you then please add to their Reputation

  5. #5
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: If w/ Nested OR and AND driving me crazy

    Many members are unable to see images in the *.png format due to forum compatibility issues with some browsers.

    If you need to post an image post it in the *.jpg format.

    Even better than posting images... post a SMALL sample file. That way we can test solutions directly in the file with the relevant data.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  6. #6
    Registered User
    Join Date
    12-01-2016
    Location
    Denver
    MS-Off Ver
    Mac 2011
    Posts
    10

    Re: If w/ Nested OR and AND driving me crazy

    Quote Originally Posted by Tony Valko View Post
    Many members are unable to see images in the *.png format due to forum compatibility issues with some browsers.

    If you need to post an image post it in the *.jpg format.

    Even better than posting images... post a SMALL sample file. That way we can test solutions directly in the file with the relevant data.
    UPDATE:

    Sorry, I didn't know about the .png files

    Here is the formula and data:

    =IF(OR(AND($AL674>=95,$AK674>= 80), AND($AG674>=18,$AH674>= 17),AND($AL674>=95,$AH674>=17),AND($AK674>=80,$AG674>=18),($AP674>=470)),"Yes","No")

    AG=14
    AH=17
    AK=66
    AL=82
    AP=0

    It should return “No”, but it is returning “Yes”.


    When I tried to put this in a new sample sheet to upload, the formula worked correctly and returned "No"

    The test scores are being pulled using a VLOOKUP and they are being pulled correctly. They are formatted as numbers. I am lost on why the formula would work in new sheet but not original.

    Unfortunately, due to FERPA and the size, I cannot upload the original.

  7. #7
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2406 (Windows 11 23H2 64-bit)
    Posts
    81,782

    Re: If w/ Nested OR and AND driving me crazy

    You can post a cut-down desensitised version of your workbook.

    1. Make sure that your sample data are REPRESENTATIVE of your real data. The use of unrepresentative data is very frustrating and can lead to long delays in reaching a solution.

    2. Make sure that your desired solution is also shown (mock up the results manually).

    3. Make sure that all confidential data is removed or replaced with dummy data first (e.g. names, addresses, E-mails, etc.).

    4. Try to avoid using merged cells as they cause lots of problems.

    Unfortunately the attachment icon doesn't work at the moment, so to attach an Excel file you have to do the following: just before posting, scroll down to Go Advanced and then scroll down to Manage Attachments. Now follow the instructions at the top of that screen.

    Please pay particular attention to point 2 (above): without an idea of your intended outcomes, it is often very difficult to offer appropriate advice.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  8. #8
    Registered User
    Join Date
    12-01-2016
    Location
    Denver
    MS-Off Ver
    Mac 2011
    Posts
    10

    Re: If w/ Nested OR and AND driving me crazy

    Sample File Attached

    Issue is resolved if I replace VLOOKUP results by retyping what they return, but I don't understand why.
    Attached Files Attached Files

  9. #9
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2406 (Windows 11 23H2 64-bit)
    Posts
    81,782

    Re: If w/ Nested OR and AND driving me crazy

    I don't understand the spreadsheet - where exactly is the VLOOKUP formula that isn't working? Or am I not understanding?

  10. #10
    Registered User
    Join Date
    12-01-2016
    Location
    Denver
    MS-Off Ver
    Mac 2011
    Posts
    10

    Re: If w/ Nested OR and AND driving me crazy

    The VLOOKUP is in cells AD:AQ; however, it is working fine and returning the correct results. But if I type over the VLOOKUP results, I get the correct result for the IF functions in I:AB.

    If I leave the VLOOKUP results alone, I:AB does not return the correct results

  11. #11
    Forum Expert
    Join Date
    10-09-2014
    Location
    Newcastle, England
    MS-Off Ver
    2003 & 2013
    Posts
    1,986

    Re: If w/ Nested OR and AND driving me crazy

    try putting VALUE before each of the VLOOKUPs eg AD2 should show
    =VALUE(VLOOKUP($D2,'Student Data Table DON''T TOUCH'!$A$1:$R$5,7,FALSE))
    I think that currently your VLOOKUPs are returning TEXT rather than numbers.

  12. #12
    Registered User
    Join Date
    12-01-2016
    Location
    Denver
    MS-Off Ver
    Mac 2011
    Posts
    10

    Re: If w/ Nested OR and AND driving me crazy

    Quote Originally Posted by pjwhitfield View Post
    try putting VALUE before each of the VLOOKUPs eg AD2 should show
    =VALUE(VLOOKUP($D2,'Student Data Table DON''T TOUCH'!$A$1:$R$5,7,FALSE))
    I think that currently your VLOOKUPs are returning TEXT rather than numbers.
    This appears to solved it. Thank you so much.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Sumifs driving me crazy
    By bcann in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 11-14-2012, 10:24 PM
  2. This is driving me crazy!!
    By rtausch in forum Excel General
    Replies: 0
    Last Post: 10-15-2008, 06:33 PM
  3. Nested IF Driving me crazy
    By orpheuswaking in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-24-2007, 10:38 PM
  4. please please help driving me crazy
    By jilly jess in forum Excel General
    Replies: 1
    Last Post: 01-14-2007, 09:59 AM
  5. Error Driving Me Crazy
    By internacio in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-15-2006, 03:10 PM
  6. Driving me crazy!
    By RobEdgeler in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-03-2005, 05:19 PM
  7. [SOLVED] basic...but driving me crazy!
    By hawsoon13 in forum Excel General
    Replies: 3
    Last Post: 05-07-2005, 09:07 AM
  8. It doesn't add up - It's driving me crazy
    By Francis Hayes (The Excel Addict) in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 02-28-2005, 08:06 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1