# SWITCH in Google Sheets: syntax and examples

URL: https://goingstellar.ro/reference/sheets/switch/

SWITCH checks one expression against a list of cases and returns the value paired with the first case that is equal. A final unpaired value acts as the default. It reads better than nested IF when you map codes to labels.

## Syntax

```
SWITCH(expression, case1, value1, [default or case2, value2], …)
```

## Arguments

- `expression` (any, required: yes): The value that is compared with each case, in order.
- `case1` (any, required: yes): The first value to compare with expression.
- `value1` (any, required: yes): What is returned when expression equals case1.
- `default or case2, value2, …` (any, required: no): More case and value pairs. A last value without a pair is the default result.

## Examples

The examples use this table, starting in A1:

| Code | Size | Score | Day |
|---|---|---|---|
| 1 | S | 95 | 1 |
| 2 | M | 72 | 6 |
| 3 | L | 40 | 7 |
| 4 | XL | 58 | 3 |

```
=SWITCH(A2, 1, "Low", 2, "Medium", 3, "High")
```

Result: `Low`

Turns a code into a label. The first case that equals A2 wins. Run in a Google Sheet (English US locale) on 2026-11-29.

```
=SWITCH(A5, 1, "Low", 2, "Medium", 3, "High", "Other")
```

Result: `Other`

Code 4 has no case, so the last lone value, "Other", is returned as the default. Run in a Google Sheet (English US locale) on 2026-11-29.

```
=SWITCH(B3, "s", "Small", "m", "Medium", "l", "Large")
```

Result: `Medium`

Text cases ignore case: the cell holds M and the case is m. Run in a Google Sheet (English US locale) on 2026-11-29.

```
=SWITCH(TRUE, C3>=90, "A", C3>=70, "B", "C")
```

Result: `B`

With TRUE as the expression, each case can be a test. The first true test returns its value. Run in a Google Sheet (English US locale) on 2026-11-29.

```
=SWITCH(D3, 6, "Weekend", 7, "Weekend", "Weekday")
```

Result: `Weekend`

Several cases can return the same value. Day 6 is mapped to Weekend. Run in a Google Sheet (English US locale) on 2026-11-29.

## Common errors

- Without a default, a value that matches no case returns #N/A. Add a last lone value, or wrap the formula in IFERROR.
- The match is by equality only, and the types must agree. The text "1" does not equal the number 1, so the result is #N/A.
- A case without its value, such as SWITCH(A2, 1), returns #N/A. Every case needs a value right after it.
- For ranges such as scores, SWITCH needs TRUE as the expression. With a number as the expression, a test like C2>=90 is compared with the number and never matches. IFS is shorter for that job.

## Compared with Excel

Same syntax as Excel SWITCH. Excel added it in 2019, so older versions lack it.

## Questions and answers

### When should I use IFS instead of SWITCH?

Use SWITCH when one value is compared for equality with many options. Use IFS when every branch needs its own test, such as ranges of scores.

## Related functions

- [IFS](https://goingstellar.ro/reference/sheets/ifs/)
- [IF](https://goingstellar.ro/reference/sheets/if/)
- [IFERROR](https://goingstellar.ro/reference/sheets/iferror/)
- [VLOOKUP](https://goingstellar.ro/reference/sheets/vlookup/)
- [LOOKUP](https://goingstellar.ro/reference/sheets/lookup/)

## Sources

- [SWITCH (Docs Editors Help)](https://support.google.com/docs/answer/7013690)

