SWITCH
Evaluates an expression against a list of values and returns the result corresponding to the first matching value. If there is no match, an optional default value may be returned.
LogicalLogic & ConditionsModern Excel Functions
What it does
Evaluates an expression against a list of values and returns the corresponding result.
Syntax
SWITCH(expression, value1, result1, [value2, result2], ..., [default])
Arguments
expression(value) β Value to match.
Examples
Map a status code
Return a label for a status code.
FORMULA
=SWITCH(A2,"O","Open","C","Closed","Unknown")
RESULT
Open
SAMPLE DATA
| A | |
|---|---|
| 1 | Status code |
| 2 | O |
| 3 | C |
| 4 | X |