Category: FUNCTION | Updated: 2026-11-20
How to Use the SWITCH Function in Google Sheets | Match One Value Against Multiple Cases
How to Use the SWITCH Function
The SWITCH function is a logical function that tests one expression (or cell value) against a list of values (cases) and returns the result corresponding to the first exact match.
Syntax
=SWITCH(expression, case1, value1, [case2, value2, ...], [default])
- expression: The cell reference or formula to test against the cases (required).
- case1: The first value to compare against
expression(required). - value1: The value to return if
expressionmatchescase1(required). - default: A single fallback value at the end to return if no cases match (optional).
Table Example
Here is an example of displaying the corresponding branch name from a list of office codes.
| Row | Column A (Office Code) | Column B (Branch Name) |
|---|---|---|
| 1 | Office Code | Branch Name |
| 2 | 1 | =SWITCH(A2, 1, "Tokyo HQ", 2, "Osaka Branch", 3, "Fukuoka Branch", "Unassigned") → Tokyo HQ |
| 3 | 3 | =SWITCH(A3, 1, "Tokyo HQ", 2, "Osaka Branch", 3, "Fukuoka Branch", "Unassigned") → Fukuoka Branch |
| 4 | 9 | =SWITCH(A4, 1, "Tokyo HQ", 2, "Osaka Branch", 3, "Fukuoka Branch", "Unassigned") → Unassigned |
- Formula:
=SWITCH(A2, 1, "Tokyo HQ", 2, "Osaka Branch", 3, "Fukuoka Branch", "Unassigned")
Common Errors and Notes
- Comparison operators (
>=,<) and wildcards cannot be used:SWITCHonly checks for exact matches. Range checks like">80"or partial matches like"*Tokyo*"do not work; use theIFSfunction for those cases. #N/Aerror whendefaultis omitted: If you omit the finaldefaultargument and none of the cases match, an#N/Aerror is returned.- Data type mismatch between numbers and text: If a cell contains the text
"1"and your case specifies the number1, they will not match. Make sure the data types are consistent.
Frequently Asked Questions
Q. How should I choose between SWITCH and IFS?
A. SWITCH is simpler when matching a single cell's value by exact match, such as "1 for Tokyo, 2 for Osaka". Use IFS when you need comparison operators like "80 or higher" or multi-column conditions like "Column A is Tokyo and Column B is 100 or more".
Q. Can I specify a fallback value in SWITCH when none of the cases match?
A. Yes, you can specify a default value as the final unpaired argument (e.g., "=SWITCH(A2, 1, \"Tokyo\", 2, \"Osaka\", \"Other\")").