Skip to content
ArumSoft Learning
KO

    The 20 Most-Used Excel Functions · Tutorial 11 of 20

    How to Use the IFS Function in Excel

    Sort values into grades, tiers and price bands with IFS instead of nested IFs, and know when SWITCH or a lookup table is the better choice.

    Level
    Intermediate
    Time
    13 min read
    Updated:
    Applies to:
    Excel for Microsoft 365, Excel 2021, Excel 2019, Excel for the web
    Fiona's 65 isn't in E2:E6, so XLOOKUP takes the next smaller value, 60, and returns its grade, D.
    Example: Fiona's 65 isn't in E2:E6, so XLOOKUP takes the next smaller value, 60, and returns its grade, D.

    What you'll learn

    • Write an IFS formula that returns a result for the first TRUE condition
    • Order the conditions so every value lands in the right band
    • Add a TRUE catch-all so IFS never returns #N/A
    • Choose between IFS, nested IF, SWITCH and a lookup table

    Function Playground

    Try IFS in a live sheet

    Type formulas in an Excel-style grid and watch each step of the calculation. Free, no sign-up.

    IFS checks a list of conditions in order and returns the result paired with the first one that is TRUE. It's the tidy way to sort a value into three or more bands, such as letter grades, commission tiers or shipping prices, without stacking one IF inside another. IFS is available in Excel 2019 and later, Excel for Microsoft 365 and Excel for the web.

    The syntax

    =IFS(logical_test1, value_if_true1, [logical_test2, value_if_true2], ...)
    • logical_test1 is required: the first condition, a comparison that is TRUE or FALSE, such as B2>=90.
    • value_if_true1 is required: what IFS returns when logical_test1 is TRUE. It can be text in quotes, a number, a cell reference or a calculation.
    • logical_test2, value_if_true2, … are optional further pairs, always a test followed by its result, up to 127 pairs.
    • There is no "otherwise" argument. If none of the tests is TRUE, IFS returns #N/A. To set a result for everything else, make TRUE the last test: it is always TRUE, so it catches whatever is left.
    Reading an IFS formula
    =IFS(B2>=90,"A",B2>=80,"B",B2>=70,"C",B2>=60,"D",TRUE,"F")
    1. B2>=90Test 1, checked first
    2. "A"Returned if test 1 is TRUE, and IFS stops there
    3. B2>=80Test 2, checked only if test 1 is FALSE
    4. "B"Returned if test 2 is the first TRUE test
    5. TRUEThe catch-all: always TRUE, so it takes every score left over
    6. "F"Returned when no earlier test is TRUE

    Turn scores into letter grades

    The sheet below lists six students and their scores. The goal is a letter grade in column C: A for 90 or more, B for 80 or more, C for 70 or more, D for 60 or more and F for anything lower. Ignore the small table in E:F for now; you'll use it later.

    1. Click the first grade cell

      Click C2, next to Aiden's score.

      ABCDEF
      1StudentScoreGradeMin scoreGrade
      2Aiden940F
      3Bella8160D
      4Carlos7770C
      5Dana9080B
      6Ethan5890A
      7Fiona65
      Six scores in column B. The grade goes in column C. E1:F6 holds the same grade bands as a table.
    2. Type the IFS formula, highest band first

      Type the formula below and press Enter. Each test is followed by a comma and its result, and TRUE,"F" at the end handles every score under 60.

      =IFS(B2>=90,"A",B2>=80,"B",B2>=70,"C",B2>=60,"D",TRUE,"F")

      The result is A: Aiden's 94 makes the very first test TRUE, so IFS returns "A" and doesn't look any further.

      ABCDEF
      1StudentScoreGradeMin scoreGrade
      2Aiden94A0F
      3Bella8160D
      4Carlos7770C
      5Dana9080B
      6Ethan5890A
      7Fiona65
      Every test reads the same cell, B2, so it's outlined once in the formula's colour.
    3. Fill the formula down

      Double-click the fill handle of C2 to copy the formula down to C7.

      ABCDEF
      1StudentScoreGradeMin scoreGrade
      2Aiden94A0F
      3Bella81B60D
      4Carlos77C70C
      5Dana90A80B
      6Ethan58F90A
      7Fiona65D
      The grades: A, B, C, A, F and D. Dana's 90 is an A because >= includes the boundary.

    Here is what IFS does with Bella's 81 in row 3:

    TestFor 81What happens
    B3>=90FALSEIFS moves on to the next test
    B3>=80TRUEIFS returns "B" and stops
    B3>=70, B3>=60, TRUEnot checkedIFS already has its answer

    Ethan's 58 fails all four comparisons, so the TRUE catch-all gives him F.

    Order matters: the first TRUE wins

    IFS doesn't look for the best match. It returns the result of the first test that is TRUE. Write the same bands in the opposite order and almost everyone gets a D:

    =IFS(B2>=60,"D",B2>=70,"C",B2>=80,"B",B2>=90,"A",TRUE,"F")
    ABCDEF
    1StudentScoreGradeMin scoreGrade
    2Aiden94D0F
    3Bella81D60D
    4Carlos77D70C
    5Dana90D80B
    6Ethan58F90A
    7Fiona65D
    With the lowest band first, 94, 81, 77 and 90 all pass B2>=60 and stop there, so they all get D.

    Excel shows no error, so this mistake is easy to miss. Two rules keep the order right:

    • With >= or >, start with the largest threshold and work down, as in the grade formula.
    • With <= or <, start with the smallest threshold and work up, as in the shipping scenario below.

    End with TRUE, or get #N/A

    Leave out the catch-all and any value that fails every test returns #N/A:

    =IFS(B2>=90,"A",B2>=80,"B",B2>=70,"C",B2>=60,"D")
    ABCDEF
    1StudentScoreGradeMin scoreGrade
    2Aiden94A0F
    3Bella81B60D
    4Carlos77C70C
    5Dana90A80B
    6Ethan58#N/A90A
    7Fiona65D
    Without TRUE at the end, Ethan's 58 matches no test and IFS returns #N/A.

    Add TRUE,"F" as the last pair and Ethan gets his F. Anything you write after a TRUE pair is never reached, so TRUE always goes last.

    Real-world scenarios

    Sales

    Commission tiers

    Reps earn 8% on sales of 50,000 or more, 5% from 25,000, 3% from 10,000 and nothing below that. Because the tests use >=, the biggest threshold comes first.

    ABCD
    1RepSalesRateCommission
    2Kim62,0008%4,960
    3Lee31,5005%1,575
    4Park25,0005%1,250
    5Ray8,2000%0
    IFS returns the rate in column C. Column D multiplies Sales by that rate.
    =IFS(B2>=50000,8%,B2>=25000,5%,B2>=10000,3%,TRUE,0)

    Kim's 62,000 earns 8%, so =B2*C2 in D2 gives a commission of 4,960. Lee and Park both get 5%; Park's 25,000 sits exactly on the boundary, and >= includes it, so Park earns 1,250. Ray's 8,200 falls through to the catch-all, 0.

    Inventory

    Shipping price by weight

    A shop charges 5 up to 1 kg, 9 up to 5 kg, 15 up to 20 kg and 30 for anything heavier. These tests use <=, so the order flips: the smallest limit comes first.

    ABC
    1ParcelWeight (kg)Cost
    2P-010.85
    3P-023.59
    4P-0359
    5P-041215
    6P-052630
    Each parcel stops at the first limit its weight fits under.
    =IFS(B2<=1,5,B2<=5,9,B2<=20,15,TRUE,30)

    The costs are 5, 9, 9, 15 and 30. P-03 weighs exactly 5 kg, so B4<=5 is TRUE and it pays 9, not 15. Had the 20 kg test come first, every parcel up to 20 kg would have cost 15.

    Budget

    Budget traffic light

    A monthly budget shows Over when spending is above the budget, Close when it has reached 90% of the budget, and OK otherwise. The tests can be calculations, not only cell-versus-number comparisons.

    ABCD
    1CategoryBudgetSpentStatus
    2Groceries450512Over
    3Dining out200185Close
    4Transport12096OK
    5Fun150150Close
    Over is tested first, so Close only applies to rows that aren't already over.
    =IFS(C2>B2,"Over",C2>=B2*90%,"Close",TRUE,"OK")

    Groceries (512 of 450) is Over. Dining out (185 of 200) and Fun (exactly 150 of 150) are Close: 185 is at least 180, and 150 is not above 150 but is at least 135. Transport (96 of 120) is OK, because 96 is under 108.

    HR

    Training status with IFS and AND

    Employees are certified when they score at least 70 and have finished the lab. A passing score without the lab means "Finish lab"; anything else means "Retake test". Each IFS test can be an AND or OR, and the strictest test goes first.

    ABCD
    1EmployeeTestLab doneStatus
    2Grace88YesCertified
    3Henry74NoFinish lab
    4Iris65YesRetake test
    5Jack70YesCertified
    The first test needs both conditions. The second only runs if the first one failed.
    =IFS(AND(B2>=70,C2="Yes"),"Certified",B2>=70,"Finish lab",TRUE,"Retake test")

    Grace and Jack (exactly 70) are Certified. Henry passed the test but hasn't done the lab, so he gets Finish lab. Iris scored 65 and gets Retake test, even though her lab is done. Swap the first two pairs and Grace and Jack would wrongly see "Finish lab".

    IFS, nested IF, SWITCH or a lookup table?

    The grade formula written with nested IFs gives exactly the same results and works in every version of Excel, but every extra band adds another IF and another closing bracket:

    =IF(B2>=90,"A",IF(B2>=80,"B",IF(B2>=70,"C",IF(B2>=60,"D","F"))))

    SWITCH (Excel 2019 and later) compares one value with a list of exact matches, and its last argument is a default, so it doesn't need a TRUE pair. It suits codes and labels, not ranges of numbers. This turns Aiden's grade in C2 into 4 grade points:

    =SWITCH(C2,"A",4,"B",3,"C",2,"D",1,0)

    For many bands, or bands that change, put them in a table and look them up. The table in E1:F6 lists the lowest score for each grade. XLOOKUP with match mode -1 finds an exact match or, failing that, the next smaller value:

    =XLOOKUP(B7,E2:E6,F2:F6,,-1)
    ABCDEF
    1StudentScoreGradeMin scoreGrade
    2Aiden94A0F
    3Bella81B60D
    4Carlos77C70C
    5Dana90A80B
    6Ethan58F90A
    7Fiona65D
    Fiona's 65 isn't in E2:E6, so XLOOKUP takes the next smaller value, 60, and returns its grade, D.

    To change a cut-off, you edit one cell in the table instead of every formula. When you fill this formula down, lock the table with $E$2:$E$6 and $F$2:$F$6. XLOOKUP needs Excel 2021 or Microsoft 365; in older versions, =VLOOKUP(B7,$E$2:$F$6,2,TRUE) does the same job as long as the first column is sorted from smallest to largest.

    ApproachBest forResult for "everything else"Versions
    IFS3 to 6 bands, or tests that mix different conditionsadd TRUE,"…" as the last pairExcel 2019 and later
    Nested IFthe same jobs in older versionsthe last value_if_falseall versions
    SWITCHone value compared with exact matchesthe last argumentExcel 2019 and later
    Lookup tablemany bands, or bands that change oftenthe lowest band in the tableXLOOKUP: Excel 2021 and later; VLOOKUP: all

    Common mistakes

    • Bands in the wrong order. The first TRUE test wins, so B2>=60 before B2>=90 gives a 94 a D. There's no error, only wrong labels. With >=, start from the largest threshold; with <=, from the smallest.
    • No catch-all. A value that fails every test returns #N/A. End the formula with TRUE, and the result for everything else.
    • An "else" value without TRUE. =IFS(B2>=90,"A",B2>=80,"B","F") tries to use "F" like IF's last argument. IFS needs pairs, so Excel won't accept the formula. Write TRUE,"F" instead.
    • Gaps between bands. =IFS(B2>80,"High",B2<80,"Low") has no test for exactly 80, so 80 returns #N/A (or falls into the catch-all, if you added one). Use >= on one side so every value belongs somewhere.
    • #NAME? in an older Excel. Excel 2016 and earlier one-time-purchase versions don't have IFS, so a workbook that uses it shows #NAME? there. Use nested IF if the file must work in those versions.

    Practice

    Practice

    Grade the class

    Use the sheet below. Click a highlighted cell, type a formula in the bar above the sheet and press Enter. Afterwards, try it in Excel itself:

    1. List eight scores between 40 and 100, including one that is exactly 80.
    2. Grade them with IFS, highest band first and TRUE,"F" at the end, and fill the formula down.
    3. Swap the first two pairs and watch which grades change, then put them back.
    4. Build a band table next to the scores and get the same grades with XLOOKUP and match mode -1.

    Try it0 of 4 done

    1. In C2, use IFS to give A for 90 or more, B for 80 or more, C for 70 or more, D for 60 or more, and F for everything else.
    2. In C3, grade the score in B3 the same way.
    3. In C6, grade the score in B6. It's under 60, so only the TRUE catch-all can give it an F.
    4. In C7, get the grade from the band table in E2:F6 instead, with XLOOKUP and match mode -1 (exact match or next smaller).

    Click a dashed cell, type a formula in the bar and press Enter.

    ABCDEF
    1StudentScoreGradeMin scoreGrade
    2Aiden940F
    3Bella8160D
    4Carlos7770C
    5Dana9080B
    6Ethan5890A
    7Fiona65

    Related

    Was this guide helpful? Spot a mistake? Send feedback · admin@arumsoft.com