ExcelHero

The SWITCH function

Compares one value with a list and returns the matching result.

In German Excel: ERSTERWERT

How to write it

=SWITCH(expression, value1, result1, [default])
expression
The value to compare.
value1, result1
A value, and what to show for it.
default
Optional. What to show when nothing matches.

💡 Without a default you get #N/A when nothing matches.

Try it

Write out the size of order 501: S is Small, M is Medium, L is Large.

A
B
C
1
Order
Size
Size name
2
501
S
3
502
L
4
503
M
5
504
XL

SWITCH(B2, "S", "Small", …): a code, then its name.