🔀 Logical Function · intermediate
SWITCH Function in Google Sheets
Returns the value matching the first matching case. Lookup-style branching for equality matches.
Syntax
SWITCH(expression, case1, value1, [case2, value2, ...], [default])Returns: Value paired with first matching case, or default.
Excel equivalent: SWITCH (identical, Excel 2019+)
Introduced: 2018
Parameters
| Name | Required | Description |
|---|---|---|
| expression | Required | Value to match. |
| case1, case2, ... | Required | Possible values. |
| value1, value2, ... | Required | What to return for each case. |
| default | Optional | Value if no match. |
Examples
Day name
=SWITCH(WEEKDAY(TODAY()), 1, "Sun", 2, "Mon", 3, "Tue", 4, "Wed", 5, "Thu", 6, "Fri", 7, "Sat")Day name for today.
Status code
=SWITCH(A2, "P", "Paid", "U", "Unpaid", "O", "Overdue", "Unknown")Trailing default.
Currency
=SWITCH(A2, "US", "$", "EU", "€", "UK", "£", "$")Symbol from region.
When to use an alternative
- IFS — Inequalities.
- VLOOKUP — Mapping is large/dynamic.
- Nested IF — 2 cases only.
Common errors and how to fix them
#N/A
Cause: No case matched, no default.
Fix: Include a default.
Related functions
IFS
Evaluates multiple conditions in order and returns the value associated with the first TRUE conditio...
IF
Returns one value when a condition is true and a different value when false. The foundation of condi...
VLOOKUP
Looks up a value in the first column of a range and returns a value from a column you specify in the...
XLOOKUP
Modern replacement for VLOOKUP, HLOOKUP, and INDEX/MATCH. Searches a range or array for a match and ...
AND
Returns TRUE if ALL arguments are TRUE....
Frequently Asked Questions
SWITCH vs IFS?
SWITCH for ONE expression vs many equality cases. IFS for different conditions (inequalities).
Cases as formulas?
Yes — any expression.