IFS function

IFS(Condition, ThenValue, OtherCondition..., OtherThenValue...) IFS(Condition; ThenValue; OtherCondition...; OtherThenValue...)

Condition

Logical

The condition to check.

ThenValue

The value to return if the condition is TRUE.

OtherCondition

Logical (accepts many)

An additional condition to check.

OtherThenValue

(accepts many)

An additional value to return if the preceding condition is TRUE.

Returns

? or { ? }

The value associated with the first condition which is TRUE (evaluated from left to right). If no condition is TRUE, a blank value is returned.

Returns one of the given values based on logical conditions. IFS(Field1 > 20, 2, Field2 > 40, 4, TRUE, 6)IFS(Field1 > 20; 2; Field2 > 40; 4; TRUE; 6) returns 2 if Field1 has a value greater than 20, 4 if Field1 does not have a value greater than 20 and Field2 has a value greater than 40, and 6 otherwise.

IFS is mostly identical to IF, with the sole difference being that IFS does not support a fallback value, that is, a value that is returned if no condition evaluates to TRUE. As such, the equivalent to IF(Field1 > 20, 2, Field2 > 40, 4, 6)IF(Field1 > 20; 2; Field2 > 40; 4; 6) is IFS(Field1 > 20, 2, Field2 > 40, 4, TRUE, 6)IFS(Field1 > 20; 2; Field2 > 40; 4; TRUE; 6)—note that the final condition is TRUE, enabling a fallback value to be used with IFS.

IFS is provided for compatibility with spreadsheets. Use the plain IF function if spreadsheet-compatibility is not a concern. Also, refer to the documentation for IF for an extended discussion and many more examples.

Examples

IFS(TRUE, 2, TRUE, 4)IFS(TRUE; 2; TRUE; 4)

Returns 2.

IFS(FALSE, 2, TRUE, 4)IFS(FALSE; 2; TRUE; 4)

Returns 4.

IFS(Field1 > 20, 2, Field2 > 40, 4, TRUE, 6)IFS(Field1 > 20; 2; Field2 > 40; 4; TRUE; 6)

Returns 2 if Field1 has a value greater than 20, 4 if Field1 does not have a value greater than 20 and Field2 has a value greater than 40, and 6 otherwise.