+ Reply to Thread
Results 1 to 7 of 7

IFS not working. Why?

  1. #1
    Registered User
    Join Date
    07-11-2022
    Location
    New Zealand
    MS-Off Ver
    Microsoft 365
    Posts
    15

    IFS not working. Why?

    Hi.

    My IFS formula isn't working properly. It is returning the result for the first condition which is clearly incorrect and repeating the result in the other rows.

    Not sure where I'm making the mistake here as I checked some online tutorials which shows the exact same syntax. I even recreated the school grade one as shown in MS Support just to test it and still it didn't work.

    Thanks in advance for your time and help.
    Attached Files Attached Files

  2. #2
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,809

    Re: IFS not working. Why?

    As I understand it, IFS() works from left to right until the first TRUE result from the logic test, then returns the corresponding value in the next argument. In this case, all of the non-zero values are greater than 91 (even if they are also greater than a subsequent logic test), so it returns 20.

    At 5 conditions, I would be inclined to use a lookup function. In K4:K8, enter 91, 151, etc. (the lower bound from the text in column L), then use something like =VLOOKUP(D4,$K$4:$M$8,3,TRUE). TRUE in the 4th argument causes VLOOKUP() to perform an "approximate match" search which is often missing from most tutorials (this tutorial does not neglect to explain the behavior of TRUE: https://www.ablebits.com/office-addi...ximate-vlookup ).

    If you still prefer to use IFS(), then you will need to arrange the lookup tests so they either are less than max value of range [IFS(D4<91,"out of range",D4<151,20,D4<281,32,...)] or arrange the greater than arguments in descending order [IFS(D4>1200,125,D4>501,80,D4>281,50,...)]. Just remember that IFS() tests from left to right until the first TRUE test.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  3. #3
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,307

    Re: IFS not working. Why?

    Try:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Note that numbers in quotes are text values and not numeric. "20" is NOT the same as 20.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  4. #4
    Registered User
    Join Date
    07-11-2022
    Location
    New Zealand
    MS-Off Ver
    Microsoft 365
    Posts
    15

    Re: IFS not working. Why?

    Thanks MrShorty and TMS for your help.

    The IFS is what I need for this job and it is now working correctly. This is the end result:

    =IFS(F18<91,0,F18<151,20,F18<281,32,F18<501,50,F18<1200,80,F18<>2300,125)

  5. #5
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,307

    Re: IFS not working. Why?

    You're welcome.

    I don't think this does what you think it does … it's very specific: F18<>2300,125. It's saying, If F18 is not equal to 2300, then return 125.




    If you are satisfied with the solution(s) provided, please mark your thread as Solved.


    New quick method:
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save


    You may also want to consider thanking those people who helped you by clicking on the little star at the bottom left of their reply to your question.

  6. #6
    Registered User
    Join Date
    07-11-2022
    Location
    New Zealand
    MS-Off Ver
    Microsoft 365
    Posts
    15

    Re: IFS not working. Why?

    You're right. I changed it back to F18<2300,125. Thanks!

  7. #7
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,307

    Re: IFS not working. Why?

    Ok. And then you probably need to put back the TRUE, "out of range" bit.

+ 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. Replies: 1
    Last Post: 08-30-2017, 02:32 AM
  2. Replies: 1
    Last Post: 02-27-2016, 06:28 PM
  3. Replies: 3
    Last Post: 05-14-2015, 07:32 AM
  4. Replies: 4
    Last Post: 09-03-2013, 02:52 AM
  5. Replies: 9
    Last Post: 03-08-2013, 11:50 AM
  6. Replies: 2
    Last Post: 08-17-2012, 08:16 AM
  7. Replies: 1
    Last Post: 01-26-2005, 04:20 AM

Tags for this Thread

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