SWITCH Function
Compare a value with a list of cases and return the result of the first match. test_or_expression is compared with each test_or_case in turn, and SWITCH returns the result that follows the first equal case. A last argument without a pair is the default, returned when no case matches; without a default, no match returns #N/A.
Syntax
SWITCH(test_or_expression, result, test_or_case, result)
Category: Logical. Minimum arguments: 2. Maximum arguments: 255.
Available for supported offline calculation.
Examples
=SWITCH(FALSE,1,TRUE,2)
The formula returns 2, the result of the case TRUE.
Cell and range examples require appropriate input values in the referenced cells. Handle invalid arguments, formula errors and array and spill constraints.