Excel SWITCH function
Compares a value with a list of options and returns the matching result. In Spanish Excel it is called CAMBIAR.
Syntax
English Excel
=SWITCH(expression, value1, result1, [default_or_value2, result2], …)
Spanish Excel (Mexico)
=CAMBIAR(expresión, valor1, resultado1, [predeterminado_o_valor2, resultado2], …)
Spanish Excel (Spain, Latin America)
=CAMBIAR(expresión; valor1; resultado1; [predeterminado_o_valor2; resultado2]; …)
| Argument | What it is |
|---|---|
| expression | The value to compare. |
| value1 | The first option. |
| result1 | What it returns on a match. |
| default_or_value2, result2optional | More pairs; a final unpaired value is the default. |
Example
SWITCH(value, option1, result1, option2, result2…, default) compares a value with a list of options. It is ideal for turning codes into names.
=SWITCH(B2,"N","North","S","South","Central")
Common mistake
It only checks equality. For ranges (greater than, less than) use IFS.
About Ads
This site uses Google AdSense to display ads. These ads help us keep WebHerramientas completely free. Ads are managed by Google and meet strict security and privacy standards.
Ads help us keep WebHerramientas free for everyone
Practice SWITCH
Type the formula in the sheet and check it instantly. Spanish or English function names both work. See all lessons
SWITCH
SWITCH(value, option1, result1, option2, result2…, default) compares a value with a list of options. It is ideal for turning codes into names.
In C2, translate the code: N is "North", S is "South" and anything else is "Central".
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Order | Code | Region | |
| 2 | P-01 | N | ||
| 3 | P-02 | S | ||
| 4 | P-03 | C | ||
| 5 | P-04 | N | ||
| 6 | P-05 | S | ||
| 7 |
Tip: while typing, click a cell or drag across several to insert their reference.
Frequently asked questions
- What is SWITCH called in Spanish?
- In Spanish Excel it is CAMBIAR. The formula =SWITCH(B2,"N","North","S","South","Central") is written =CAMBIAR(B2;"N";"Norte";"S";"Sur";"Centro") (or with commas in Mexico).
- Why does SWITCH use semicolons in some Excel versions?
- It depends on regional settings. Where the comma is the decimal mark (Spain, much of South America), Excel separates arguments with semicolons. English Excel and Mexican Spanish Excel use commas.
- What is the most common SWITCH mistake?
- It only checks equality. For ranges (greater than, less than) use IFS.