SWITCH Function
Compares one value against a list of options and returns the matching result.
Category
Logical
Available in
Excel 2019+, Microsoft 365
Returns
The result paired with the first matching value
Overview
SWITCH looks at one value and finds it in a list of exact options — like a small lookup table written right inside the formula.
It's tidier than nested IFs when every test is “is this cell equal to …?”. Add a final unpaired value as the default.
Syntax
Arguments
| Argument | Required? | What it does |
|---|---|---|
| expression | Yes | The value to compare, such as a cell or a calculation. |
| value1, result1 | Yes | The first option and what to return when expression matches it. |
| value2, result2, … | Optional | More option/result pairs, up to 126. |
| default | Optional | Returned when nothing matches. Without it, no match gives #N/A. |
Examples
Example 1 — Region codes to names
Northstar's system exports one-letter region codes.
| A | B | C | |
|---|---|---|---|
| 1 | Order | Code | Region |
| 2 | 1001 | E | East |
| 3 | 1002 | W | West |
| 4 | 1003 | N | North |
| 5 | 1004 | X | Unknown |
Example 2 — Switching on a calculation
Label a date as Weekend or Weekday.
Example 3 — The SWITCH(TRUE) trick
Compare against TRUE to use ranges instead of exact values.
Common mistakes
- #N/A errors. No option matched and there's no default. Add one at the end.
- Numbers stored as text. The number 1 doesn't match the text "1". Make sure the types agree.
Notes
- If the list of options changes often, keep it in a table and use XLOOKUP instead.
- Related functions: IFS, IF, CHOOSE, XLOOKUP.

Author
Kyle Stott
Certified Microsoft Excel Expert
Kyle has worked professionally with Microsoft Excel for over a decade and has consulted on and taught Excel best practices to over 400 companies across 30+ countries.