Skip to content

Excel IFS function: syntax and worked examples

IFS checks several conditions and returns the result for the first TRUE condition. Use it for ordered rules, put a default at the end when needed, and test the values on either side of every threshold.

Watch: Excel IFS function: syntax and worked examples05:25 · opens on YouTube
Video: Excel IFS function: syntax and worked examples (05:25) on the Power Concepts YouTube channel.

Use IFS when one cell needs a result chosen from several conditions. For example, classify an order as Large at 100 units or more, Medium from 25 up to but not including 100, and Small below 25. The first matching rule wins, so the order of the tests is part of the calculation.

Microsoft’s IFS documentation sets out the function’s syntax and error behaviour. The examples here use fictional operational rules that you can check in a blank worksheet.

IFS syntax and a default result

=IFS(logical_test1,value_if_true1,logical_test2,value_if_true2,TRUE,default_result)

Supply a test and result together. Put text results in straight quotation marks. The final TRUE is an always-matching test, so its result acts as a fallback. Put that pair last; placing it first would make later rules irrelevant.

These formulas use commas. Use your regional argument separator if Excel expects semicolons instead.

Example 1: classify order quantities

Enter a numeric quantity in B2, then put this formula in C2:

=IFS(B2>=100,"Large",B2>=25,"Medium",TRUE,"Small")

At 100 units, both numeric tests are true. The earlier Large rule determines the result. If you put B2>=25 first, a 100-unit order would incorrectly become Medium.

Use these checks before copying the formula down:

Worksheet example: inputs in column B and calculated categories in C
RowB — QuantityC — Expected result
20Small
324Small
425Medium
599Medium
6100Large
7125Large
Enter the formula in C2 and fill it down to C7. The relative reference advances from B2 to B7. The 24/25 and 99/100 pairs check both sides of each boundary.

The same rule can be written with nested IF:

=IF(B2>=100,"Large",IF(B2>=25,"Medium","Small"))

For two thresholds, either version is manageable. IFS becomes useful when its flat sequence of test/result pairs is easier for your team to maintain.

Handle blank, text and invalid input explicitly

A default result does not validate the input. In the simple example, a blank or an invalid value may be classified when you meant to flag it. Keep blanks empty, reject text and reject negative quantities before applying the size rules:

=IF(B2="","",IF(NOT(ISNUMBER(B2)),"Check units",IF(B2<0,"Check units",IFS(B2>=100,"Large",B2>=25,"Medium",TRUE,"Small"))))

Test a blank cell, the text unknown, -1, 0, 25 and 100. Expected results are blank, Check units, Check units, Small, Medium and Large. A number stored as text also needs review; do not assume it is the same as a numeric quantity.

If your source cells already contain errors, investigate those separately rather than wrapping the entire calculation in an error handler that hides them.

Example 2: multiple conditions with AND and OR

On a new sheet, enter ticket status in B2, numeric days open in C2, and Yes or No for urgency in D2. Assume the inputs have been validated.

The rule is: closed tickets stay closed; urgent tickets or tickets open at least five days need attention today; other open tickets at least two days old need attention soon.

=IFS(B2="Closed","Closed",OR(D2="Yes",C2>=5),"Review today",AND(B2="Open",C2>=2),"Review soon",TRUE,"Routine")
Status Days open Urgent? Expected result
Closed 8 Yes Closed
Open 0 Yes Review today
Open 5 No Review today
Open 2 No Review soon
Open 1 No Routine

The closed-ticket rule takes priority even when another condition also matches. AND combines requirements that must all hold; OR allows any of its requirements to match.

IFS, IF, SWITCH or a lookup table?

Your task Useful starting point
Choose between two results IF
Apply several ordered comparisons IFS
Map exact codes such as A, B and C to labels SWITCH or a lookup table
Maintain thresholds or labels that change frequently A separate lookup table
Add amounts from rows meeting several conditions SUMIFS

SWITCH compares one expression with listed values. It can be easier to read when matching fixed codes. IFS is more natural when the rules use different comparisons, such as a status alongside a number of days.

For the order-size example, you could put the rules in F1:G4:

Minimum units Size
0 Small
25 Medium
100 Large

For a validated non-negative numeric quantity in B2:

=XLOOKUP(B2,$F$2:$F$4,$G$2:$G$4,"Check units",-1)

The -1 asks for an exact threshold or the next smaller one. This returns Medium for 99 and Large for 100. A rule change can now be made in the table rather than inside every formula. Our XLOOKUP and INDEX MATCH comparison explains the lookup options.

For an older Excel version without XLOOKUP, this alternative requires the threshold column to stay sorted ascending:

=VLOOKUP(B2,$F$2:$G$4,2,TRUE)

It assumes the same validated numeric input. It is not a replacement for the blank, text and negative-value checks above.

Troubleshoot IFS errors

Symptom Check
#N/A No rule matched; check boundary conditions before deciding on a default
The wrong category appears without an error A broad or higher-priority rule is placed before the intended rule
Too few arguments Every logical test needs a corresponding result
#VALUE! A logical-test argument did not evaluate to TRUE or FALSE, or a referenced expression already contains an error
#NAME? Function support, spelling, text quotation marks or undefined names
A blank or text input receives a category Add input checks; a final TRUE is not data validation

IFS is documented for Microsoft 365 and Excel 2019, 2021 and 2024. For perpetual Excel 2016, use an appropriate IF formula or a compatible lookup. Check the versions used by workbook recipients before choosing a function.

Develop your conditional-formula skills

The free practice pack contains an IFS sheet with the quantity and ticket examples. Change the yellow input cells and inspect the formula results; the original-answer column stays fixed for comparison. Its guarded input uses ISBLANK to check an empty input cell explicitly. Follow the workbook’s labelled layout, which uses different cell coordinates from this guide.

The Excel Advanced Functions course covers conditional logic, data summaries and formulas using tables and named ranges. Compare its outline with your starting skills, or use the Excel course guide to choose an earlier level. Each course outline links to its current booking dates and fees.

Practice file

Work through the same example yourself: download the practice workbook. No sign-up required.

Common questions

How does the IFS function work in Excel?
IFS accepts pairs of logical tests and results, then returns the result associated with the first TRUE test. Put higher-priority rules first. A final TRUE test can supply a default result when earlier tests do not match.
Which versions of Excel have IFS?
Microsoft's documentation lists Excel for Microsoft 365 and Excel 2019, 2021 and 2024, including supported Mac editions. Perpetual Excel 2016 does not include IFS; use nested IF or a suitable lookup approach when compatibility requires it.
Why does IFS return #N/A?
No logical test matched. If an unmatched value is expected, add TRUE and a fallback result as the last pair. If every input should match a rule, investigate the data or rule boundaries before hiding the error.
Can I use AND or OR inside IFS?
Yes. Use AND when every part of one condition must be true, or OR when any part may be true. Each combined test still needs its own result, and the order of the IFS rules still matters.
What is the difference between IFS and SUMIFS?
IFS selects one result from ordered conditions. SUMIFS adds values from rows that meet multiple criteria. Use IFS to classify a row and SUMIFS to calculate a conditional total.