SWITCH function
Compares one value against a list of options and returns the result paired with the first exact match, with an optional default.
Available in Microsoft 365, Excel 2019 and later, Excel for the web
Excel 2019 and laterWorks in Google Sheets
Syntax
SWITCH(expression, value1, result1, [value2, result2], ..., [default])| Argument | What it means | |
|---|---|---|
expression | Required | The value to test — a cell, or a formula such as WEEKDAY(A2). It is written only once. |
value1, result1 | Required | The first value to compare against, and what to return if it matches. |
value2, result2, ... | Optional | More value/result pairs, up to 126 pairs. |
default | Optional | A single final argument without a partner, returned when nothing matches. Without it, no match gives #N/A. |
Returns: The result of the first matching value, the default, or #N/A.
How SWITCH works
SWITCH translates one value into another. You give it the thing to look at — a region code, a status number, a weekday — and then a list of possible values with the result for each. It returns the result for the first exact match. Codes to names, numbers to labels and short category mappings are classic SWITCH jobs.
Its advantage over IFS or nested IF is that the expression is written once. Compare =IF(B2="N","North",IF(B2="S","South",...)) with =SWITCH(B2,"N","North","S","South",...). The comparisons are exact equality, case-insensitive for text. If the number of arguments after the expression is odd, the last one is treated as the default value.
SWITCH cannot test ranges like "greater than 90" directly. A common workaround is SWITCH(TRUE, B2>=90, "A", B2>=75, "B", "C"): each condition is compared with TRUE, and the first one that is TRUE wins.
Examples
1Region code to region name
| A | B | C | |
|---|---|---|---|
| 1 | Store | Code | |
| 2 | Lyon | E | East |
| 3 | Nantes | W | |
| 4 | Lille | N |
Result: East
B2 holds E, which matches the third pair, so SWITCH returns East. Any code not in the list would return the default, Unknown.
2Weekend or weekday
| A | B | |
|---|---|---|
| 1 | Delivery date | |
| 2 | 2026-03-14 | Saturday |
| 3 | 2026-03-16 |
Result: Saturday
14 March 2026 is a Saturday, so WEEKDAY returns 7 and SWITCH returns Saturday. Monday 16 March gives 2, which matches nothing, so the default Weekday appears.
3Priority number with no default
| A | B | C | |
|---|---|---|---|
| 1 | Task | Priority | |
| 2 | Order toner | 4 | #N/A |
Result: #N/A
The value 4 matches none of the listed values and there is no default, so SWITCH returns #N/A.
4Bands with SWITCH(TRUE, ...)
| A | B | C | |
|---|---|---|---|
| 1 | Student | Score | |
| 2 | Ravi | 77 | B |
Result: B
Each condition is evaluated and compared with TRUE. B2>=90 is FALSE, B2>=75 is TRUE, so B is returned. The lone "C" at the end is the default.
Common errors and how to fix them
| Error | Why it happens | Fix |
|---|---|---|
#N/A | No value matched and no default was given. | Add a final default argument. |
#NAME? | Opened in Excel 2016 or earlier, which does not have SWITCH. | Use nested IF or CHOOSE for older versions. |
Tips
- Numbers and text are different values: a code typed as the number 1 does not match
"1". Keep the list consistent with how the data is stored. - For long mappings (more than about ten items) keep a two-column table and use XLOOKUP — it is easier to maintain than a very long formula.
Questions
What is the difference between SWITCH and IFS?
SWITCH compares one expression against exact values; IFS evaluates independent conditions, so it can test ranges like >=75. SWITCH also has a built-in default argument, IFS needs a TRUE pair.
Is SWITCH case-sensitive?
No. "east" matches East.
Google Sheets
SWITCH also exists in Google Sheets and works the same way for everyday use, so the examples above work there too.
SWITCH in other languages
In a non-English version of Excel the function has a local name. Excel translates formulas automatically when a file is opened in another language.
| Language | Function name |
|---|---|
| Danish | SKIFT |
| Dutch | SCHAKELEN |
| Finnish | MUUTA |
| French | SI.MULTIPLE |
| German | ERSTERWERT |
| Hungarian | ÁTVÁLT |
| Norwegian (Bokmål) | BRYTER |
| Polish | PRZEŁĄCZ |
| Portuguese (Brazil) | PARÂMETRO |
| Portuguese (Portugal) | PARÂMETRO |
| Russian | ПЕРЕКЛЮЧ |
| Spanish | CAMBIAR |
| Swedish | VÄXLA |
| Turkish | İLKEŞLEŞEN |