IFS
Receives multiple conditions and values, and returns the value matching the first
condition that evaluates to TRUE
.
This is helpful to avoid having to place a IF
inside a IF
inside a IF
…
Usage
Parameters
condition1 |
(Required) The first condition to evaluate |
value_if_true1 |
(Required) The value to use if condition1 evaluates to |
condition2 |
(Required) The second condition to evaluate |
value_if_true2 |
(Required) The value to use if condition2 evaluates to |
... |
You can provide as many conditions and values as you want. Each condition must be followed by its value_if_true. |
Examples
More information
If none of the conditions are TRUE then the IFS
function will report an error. This is to avoid
generating empty content if a case was forgotten.
If instead you want a default value for when none of the conditions are TRUE, then add a final
condition of TRUE
and specify the default value. This behaves like the if_false
parameter
of the IF
function.
Here is an example: IFS(val = 1, "one", val = 2, "two", TRUE, "")
. Here, an empty text ""
is the default value.