IFS
Returns the value for the first TRUE condition in condition-value pairs.
IFS(cond1, value1, cond2, value2, ...) evaluates left to right and short-circuits.
The Formualizer engine in this repository at 0.15.0 plus unreleased changes computes the example results. Known differences from Excel are listed on this page.
Syntax
=IFS(logical_test1, value_if_true1, [(logical_test2, value_if_true2), ...])
Arguments
| Argument | Type | Required | Default |
|---|---|---|---|
logical_test1 | any | Required | — |
value_if_true1 | any | Required | — |
logical_test2 | any | Optional | — |
value_if_true2 | any | Optional | — |
Accepts a variable number of arguments. Minimum: 2.
Return type
Can return a reference when evaluated in a reference context.
Remarks
- Conditions accept booleans and numbers (
0FALSE, non-zero TRUE); blank is FALSE.
Error cases
- Arguments must be provided as pairs; odd argument counts return
#VALUE!. - Text conditions return
#VALUE!; error conditions propagate. - If no condition is TRUE, returns
#N/A.
Examples
Return the result for the first true comparison in a sequence.
Formula =IFS(7>10,"High",7>5,"Medium")
Expected result Medium
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
The first match takes precedence when multiple conditions are true.
Formula =IFS(7>5,"Medium",7>6,"High")
Expected result Medium
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Use one unconditional comparison, the minimum supported pair.
Formula =IFS(TRUE,"Default")
Expected result Default
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
With no true condition there is no result branch to return.
Formula =IFS(FALSE,"No match")
Expected result #N/A
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
First matching condition wins
Formula =IFS(2<1, "a", 3>2, "b", TRUE, "c")
Expected result b
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
No conditions matched
Formula =IFS(FALSE, 1, 0, 2)
Expected result #N/A
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Related functions
FAQ
What errors can IFS return on structure issues?
Odd argument counts return #VALUE!, and no TRUE condition returns #N/A.