+ Reply to Thread
Results 1 to 9 of 9

IF statement not returning correct answer

  1. #1
    Registered User
    Join Date
    12-01-2016
    Location
    Texas
    MS-Off Ver
    2013
    Posts
    4

    IF statement not returning correct answer

    SOLVED
    I'm having trouble with an IF formula.

    My data is a number between -1 to -49 and 50 to 1. I'm trying to categorize this range into several categories.

    -1 to -5 = "Backed Up"

    -6 to -20 = "Yellow Zone"

    -21 to +21 = "Green Zone"

    +20 to +12 = "Hi Red Zone"

    +11 to +4 = "Lo Red Zone"

    +3 to +1 = "Goal Line"

    I've tried this, but it does not return the correct answer:

    =IF(E41>=-20,"Green Zone", IF(E41>=20,"Hi Red Zone", IF(E41>=12, "Lo Red Zone", "Goal Line")))

    if e41 = -25

    ANY Help would be greatly appreciated!!

    Thank you!
    Attached Files Attached Files
    Last edited by speedrazer; 01-23-2021 at 12:40 PM. Reason: solved

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2504 (Windows 11 Home 24H2 64-bit)
    Posts
    90,991

    Re: IF statement not returning correct answer

    Welcome to the forum.

    The bands you have outlined are not distinct: would 17 be green or hi red???

    I'd use a lookup for this, not nested IFs.

    There are instructions at the top of the page explaining how to attach your sample workbook.
    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. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

  3. #3
    Registered User
    Join Date
    12-01-2016
    Location
    Texas
    MS-Off Ver
    2013
    Posts
    4

    Re: IF statement not returning correct answer

    My data number range is a football field.

    Yard lines are labeled as such by coaches:
    100 yard field.
    -1 to -49 yard line, 50 yard line, and +49 to +1 yard line

    So, +17 (17) would be in the Hi Red zone category.

    Thank you for responding!

  4. #4
    Registered User
    Join Date
    12-01-2016
    Location
    Texas
    MS-Off Ver
    2013
    Posts
    4

    Re: IF statement not returning correct answer

    Can Vlookup, look through a range?
    ie return 'Green zone" if the range if -21 to +20 yard line?

  5. #5
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: IF statement not returning correct answer

    Do you see the logical contradiction here?

    -21 to +21 = "Green Zone"

    +20 to +12 = "Hi Red Zone

    Values between +12 and +20 belong to BOTH groups.

    Set them out logically on a sheet, read the yellow banner (top of page) and attach the file.
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU

  6. #6
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2504 (Windows 11 Home 24H2 64-bit)
    Posts
    90,991

    Re: IF statement not returning correct answer

    Yes, but not if you have overlaps:

    -21 to +21 = "Green Zone"

    +20 to +12 = "Hi Red Zone"

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

    Re: IF statement not returning correct answer

    Just looked at your attachment, but all you've shared is a non-working formula.

    Please do what Glenn asked in post #5 above and post again to a new post in this thread. We can't help until the anomaly in your suggested bands is resolved.

  8. #8
    Registered User
    Join Date
    12-01-2016
    Location
    Texas
    MS-Off Ver
    2013
    Posts
    4

    Re: IF statement not returning correct answer

    =IF(OR(E41>=21, E41<=-21), "Green Zone", IF(E41>=12, "Hi Red Zone", IF(E41>= 4, "Lo Red Zone", IF(E41>= 1, "Goal Line", IF(E41>=-5, "Backed Up", "Yellow Zone")))))

    This seems to work...

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

    Re: IF statement not returning correct answer

    OK, well in that case, please mark the thread as solved. You'll never know now how to create a lookup table!

    Next time, just answer our questions and we'll do our best to help, but don't ignore our questions, as that's a waste of our time. Also, remember that many of us here do not have Stateside knowledge of your American rules football!!!

+ 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] IF statement not returning correct result
    By kenny scott in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 12-09-2020, 10:01 AM
  2. IF statement not returning correct value
    By bdouglas1011 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-11-2018, 11:37 AM
  3. Replies: 3
    Last Post: 07-12-2016, 05:05 PM
  4. Formula not returning correct answer
    By rschase1863 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-07-2011, 11:06 PM
  5. Formula sometimes returning correct answer and sometimes returning 0
    By redimp in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-09-2010, 06:28 AM
  6. LOOKUP Formula not returning correct answer
    By preferiti in forum Excel General
    Replies: 10
    Last Post: 04-17-2009, 12:30 AM
  7. VLOOKUP not returning correct answer
    By Alan Davies in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-10-2006, 10:40 AM

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