Wauvel

Excel like a finance pro.

The functions, VBA, and shortcuts a finance operator actually uses — curated, with CFO examples. Prefer them pre-built? Grab a ready-made model.

← All functions

SWITCH

Logic & error handling

Match one value against a list of cases — cleaner than a stack of nested IFs.

Difficulty

Amateur
Excel file

1What is it?

SWITCH compares one expression against a list of values and returns the result for the first that matches exactly. It's the readable way to map a code, status, or month number to a label — where IFS tests a series of conditions, SWITCH tests one thing for equality. End with a lone default value for 'none of the above'.

2What it looks like

SWITCH(expression, value1, result1, …, [default])
expression
The single value to test (a cell, code, or number).
value1 / result1
A case to match and what to return when it matches.
[default]
A final lone argument returned when nothing matches — your catch-all.

3When you use it

  • Map a status code to a label (1 → Open, 2 → Paid, 3 → Void).
  • Turn a month number into a quarter or a name.
  • Translate a department or region code to its full name.

4See it in action

Change the inputs — the formula and result update live. Prefer the real thing? Download the Excel file and open it in Excel.

Map a numeric status code to a readable label. The code lives in B2.

C2
fx
=SWITCH(B2, 1,"Open", 2,"Paid", 3,"Void", "Unknown")Paid
ABC
1FieldValueResult
2Status codePaid

The lime cell holds the formula — click it (or any cell) to see its contents in the bar above, just like Excel. Edit the blue cells to watch it recompute.

5Common errors

#N/ANothing matched and there's no default.

Fix: Add a final lone argument as the catch-all.

Always hits defaultType mismatch — testing 1 against text "1".

Fix: Match the data type (number vs text) of the cases to the expression.

Wrong toolYou need ranges (>, <), not exact values.

Fix: Use IFS for conditions; SWITCH only tests equality.

6Better functions & alternatives

  • IF / IFS Use when you're testing ranges or compound conditions, not exact matches.
  • XLOOKUP Better when the cases live in a table you can maintain instead of hard-coding.

Want SWITCH already wired into a model? Wauvel's free tools download as branded, formula-driven Excel.

Learn the moves here — or let Wauvel run them on your numbers.

Get my free report →