Skip to content

IFS

Checks a list of conditions in order and returns the result for the first one that is true. It replaces a stack of nested IFs.

Syntax

=IFS(, , [logical_test2, value_if_true2], ...)

Logical

Excel for Microsoft 365, Excel 2024, Excel 2021, Excel 2019, Excel for the web and the mobile apps. Not available in Excel 2016 and earlier (perpetual versions), where it returns `#NAME?`.

Try it

Edit the formula in C2 or change the inputs. The sheet recalculates as you type.

C2
A
B
C
D
1
Student
Score
Rating
2
S-1
72
Fair
3
4

C2 =IFS(B2>=90,"Excellent",B2>=75,"Good",B2>=60,"Fair",TRUE,"Poor") returns Fair

How IFS works

IFS works through a list of conditions in order and returns the result that belongs to the first one that is true. It reads top to bottom, so it is easier to follow than IFs nested inside each other.

=IFS(B2>=90, "Excellent", B2>=75, "Good", B2>=60, "Fair", TRUE, "Poor")

The formula checks the score against 90, then 75, then 60. The last test is simply TRUE, which is always true, so it works as the "everything else" case.

The arguments

IFS takes pairs: a test, then the value to return if that test is true. You can give up to 127 pairs. The rules:

  • Tests are checked in order, and IFS stops at the first true one. Put the most restrictive test first. With >=60 before >=90, a score of 95 would stop at the first test.
  • If no test is true, IFS returns #N/A. IFS has no built-in "else" argument, so end the list with TRUE and a default result.
  • An odd number of arguments is an error. Excel complains that you have entered too few arguments.
  • A test must evaluate to TRUE or FALSE. A test that returns an error makes IFS return that error, even if a later test would have been true.

IFS compared with the alternatives

IFS is mostly about readability. Compared with nested IF, the formula is flatter, and each test sits next to its result. Compared with SWITCH, IFS handles ranges and conditions, while SWITCH compares one value with exact matches. Compared with a lookup table, IFS puts the thresholds inside the formula. If the thresholds are used in more than one place, or change often, put them in cells and use XLOOKUP with match mode -1, or VLOOKUP with an approximate match. Then there is one place to edit.

Compatibility

IFS was added in Excel 2019. If the workbook may open in Excel 2016 or earlier, use nested IF or a lookup instead, because IFS returns #NAME? there.

Errors

If you see #N/A, none of the tests were true. Add a final TRUE pair, or check that your thresholds cover the whole range of values, including values beyond the last band.

Arguments

logical_test1
The first condition to check, such as B2>=90. IFS stops at the first test that is true.
value_if_true1
What to return if the first test is true. It can be text, a number, a reference or a formula.
logical_test2, value_if_true2, ...optional
More test and result pairs, up to 127 pairs. Always give them in pairs: an odd number of arguments returns an error. If no test is true, IFS returns #N/A.

Examples

Each example is a live sheet. Change the inputs or the formula and watch the result.

Example 1

Grade bands with a catch-all

C2 =IFS(B2>=90,"Excellent",B2>=75,"Good",B2>=60,"Fair",TRUE,"Poor")

Result: Fair

72 fails the first two tests and passes B2>=60, so the result is Fair. The final TRUE would catch any score below 60.

C2
A
B
C
D
1
Student
Score
Rating
2
S-1
72
Fair
3
4

C2 =IFS(B2>=90,"Excellent",B2>=75,"Good",B2>=60,"Fair",TRUE,"Poor") returns Fair

Example 2

Without a catch-all, an unmatched value is #N/A

C2 =IFS(B2>=90,"Excellent",B2>=75,"Good",B2>=60,"Fair")

Result: #N/A

48 fails every test, and IFS has no default. Add TRUE and a result as the last pair to avoid the error.

C2
A
B
C
D
1
Student
Score
Rating
2
S-2
48
#N/A
3
4

C2 =IFS(B2>=90,"Excellent",B2>=75,"Good",B2>=60,"Fair") returns #N/A

Example 3

Number results: a bonus rate by sales

C2 =IFS(B2>=100000,0.1,B2>=50000,0.06,TRUE,0.02)

Result: 6%

64,000 is below 100,000 but at least 50,000, so the result is 6%. The tests run from the highest band down.

C2
A
B
C
D
1
Rep
Sales
Bonus rate
2
R-07
64,000
6%
3
4

C2 =IFS(B2>=100000,0.1,B2>=50000,0.06,TRUE,0.02) returns 6%

Example 4

Mix tests on different cells

D2 =IFS(C2="Urgent","Ship today",B2>=5000,"Review",TRUE,"Queue")

Result: Queue

Each test can look at a different cell. The order isn't Urgent and the amount is under 5,000, so it reaches the TRUE default and returns Queue.

D2
A
B
C
D
E
1
Order
Amount
Priority
Action
2
O-31
4,200
Standard
Queue
3
4

D2 =IFS(C2="Urgent","Ship today",B2>=5000,"Review",TRUE,"Queue") returns Queue

Your turn.

Solve it in the sheet. Every answer is checked, with hints if you need them.

Task 1 of 2

In D2, rate the score in column B: Excellent for 90 and above, Good for 75 and above, Fair for 60 and above, and Poor for anything lower. Fill down to D7.

Answer in D2, then it fills down to D7.

D2
A
B
C
D
E
F
1
Rep
Score
Sales
Rating
Bonus rate
2
R-01
48
31,000
3
R-02
92
128,000
4
R-03
75
64,000
5
R-04
60
50,000
6
R-05
83
99,000
7
R-06
66
12,500
8

Common mistakes

  • IFS has no default. If no test is true it returns #N/A. End the list with TRUE, "default".
  • The order of tests matters because the first true one wins. Put the most restrictive test first, such as >=90 before >=75.
  • The arguments must come in pairs. A missing result, or a stray extra argument, gives an error.
  • An error inside a test is returned even if a later test would be true. Check the cells the tests read.
  • IFS isn't available in Excel 2016 and earlier, where it returns #NAME?. Use nested IF there.
  • Thresholds typed into the formula are hard to change. If several formulas share the same bands, use a lookup table.

Questions people ask

How do I add an "else" to IFS?

Make the last pair `TRUE, "default"`. Because TRUE is always true, it catches everything the earlier tests missed.

Why does IFS return #N/A?

None of the tests were true and there is no default. Add `TRUE, "result"` as the final pair, or widen your tests.

What is the difference between IFS and nested IF?

They give the same answers. IFS lists the tests flat, so it is easier to read and edit. Nested IF works in every version of Excel, while IFS needs Excel 2019 or later.

Should I use IFS or SWITCH?

Use IFS for conditions such as ranges and comparisons. Use SWITCH when you compare one value with a list of exact matches, such as codes.

How many conditions can IFS handle?

Up to 127 test and result pairs. If you need more than a handful, a lookup table is easier to maintain.

Learn IFS in a real sheet.

IFS is taught in Logic and text, lesson 1: Nested IF and IFS. Each lesson is a short, graded exercise like the one above.