Function · Logical
Excel IFS function
The Excel IFS function returns the result of the first test that is true. A score of 86 is a B when the grade bands are tested from the top.
Syntax =IFS(logical_test1, value_if_true1, ...)
=IFS(B1>=90,"A",B1>=80,"B",B1>=70,"C",B1>=60,"D",TRUE,"F")Arguments
| Name | Required | What to pass |
|---|---|---|
| logical_test1 | Required | The first test. IFS stops at the first test that is TRUE. |
| value_if_true1 | Required | The result for that test. |
| logical_test2 | Optional | More pairs, up to 127 tests. Put TRUE last if you want a default. |
Examples
A score of 86 on a 90/80/70/60 grade scale
=IFS(B1>=90,"A",B1>=80,"B",B1>=70,"C",B1>=60,"D",TRUE,"F")Result B
| A | B | |
|---|---|---|
| 1 | Score | 86 |
| 2 | Grade | B |
IFS walks a list of tests and returns the result of the first one that is TRUE. A score of 86 is not at least 90, and it is at least 80, so the grade is B. The C, D, and F tests are not consulted. Nested IF does the same job. IFS is the form that stays readable once there are four or five bands.
Order is the whole trick. A first test of >=60 is TRUE for 86, and the function returns D. The final TRUE is the default, the same role as the last argument of IF. Leave it off and a score that misses every band returns #N/A. Excel 2016 does not have IFS. Nested IF still works there.