Excel Switch Function

If you just need to excel switch function and move on, the boxed answer at the top is all you need. The rest of this page is for when you want to understand why it works in Excel, adapt it to a trickier version, or make it robust enough to hand to a colleague. We keep the opening short on purpose — the depth is here when you want it, not in your way when you don’t.

Exact answer

In Excel: use =SWITCH(expression, case1, result1, case2, result2, …, default) — it matches one value against a list of exact cases.

Syntax

=SWITCH(expression, value1, result1, [value2, result2], ..., [default])

Arguments

ArgumentDescription
expressionrequiredThe value to compare against each case.
value1requiredThe first case to match exactly.
result1requiredWhat to return when the first case matches.
defaultoptionalAn odd final argument becomes the fallback when nothing matches.

Related functions

IFSCHOOSEIF
Annotated stepsExcel
1

Confirm the mapping is exact-match — any "greater than" logic needs IFS instead.

2

Type =SWITCH( and enter the cell or expression to test.

3

Add each case and its result as a pair, separated by commas.

4

Add one final unpaired argument as the default for unmatched values.

Ctrl+CthenCtrl+Shift+V+Cthen+Ctrl+VPaste values · WindowsMac

What this does

SWITCH evaluates an expression once and compares it against a list of exact values, returning the result paired with the first that matches. Where IFS handles arbitrary conditions such as ranges, SWITCH is for exact-match mapping — a status code to a label, a country code to a region, an abbreviation to a full name. Its default is supplied by an unpaired final argument, which is more compact than IFS's trailing TRUE. It cannot express a range comparison at all, so anything involving "greater than" belongs in IFS. Requires Excel 2019 or later. Most people learn this as a sequence of clicks and forget it by next week; learning it as a pattern instead is what lets you apply it to the next, slightly different version of the problem without starting from scratch. That is the difference this page is trying to make. For “excel switch function”, the reliable version is a short checking loop, not just the first command that appears to work. Run it on a deliberately small range first, watch how the affected formula change, and only then apply the same setup to the full sheet. When a formula is involved, keep the inputs labelled beside it, reference cells instead of typing values, and apply number formatting only after the result checks out. That is what makes a workflow that saves repeating the same clicks every week useful in real work: repeatable, auditable, and not dependent on memory or luck.

A worked example

Mapping status codes: =SWITCH(B2, "P", "Pending", "A", "Approved", "R", "Rejected", "Unknown") returns a readable label, with "Unknown" as the fallback for anything else. Mapping a month number to a quarter: =SWITCH(ROUNDUP(A2/3,0), 1,"Q1", 2,"Q2", 3,"Q3", 4,"Q4"). SWITCH turns a code-to-label mapping into one readable line, and knowing its exact-match limit tells you when to reach for IFS instead. If there is any chance you will reuse this, drop it into a small template tab right now: a labelled input area on the left and the formula beside it, checked once against the tool above. Next time the same question comes up, the answer is a single paste away instead of a rebuild from memory.

In Google Sheets

Google Sheets handles this almost identically to Excel. The formula syntax above is the same, and the menu lives under a slightly different label rather than a ribbon tab. Use the platform toggle at the top of the page to switch every keyboard shortcut between Windows and Mac, and expect at most cosmetic differences in naming. Nothing on this page is behind a login: the tool runs entirely in your browser, the formula is shown in full with one-click copy, and the steps work the same on Windows and Mac. That is the whole promise here — the exact answer, a way to prove it on your own numbers, and just enough context to make it stick. The short version of “excel switch function”: the answer is at the top of this page, the tool proves it on your own numbers, and the sections above explain why it holds so the next variation does not stump you. Excel rewards people who reference cells instead of typing values and who keep inputs separate from formulas, because that is what makes a result you can audit months later. Build it once, deliberately, with the live tool as a check, and you convert a one-off lookup into a reusable skill — which is the whole point of learning the why and not just the what.

Common mistakes

  • Trying to express a range, which SWITCH cannot do — it compares for equality only.
  • Losing count of the pairs, so the intended last result is read as the default.
  • Building a long mapping in SWITCH where a lookup table plus XLOOKUP would be easier to maintain.

Frequently asked questions

When should I use SWITCH instead of IFS?

When you are matching one value against a list of exact possibilities. IFS is for conditions such as ranges.

How do I set a default?

Add a single unpaired argument at the end. If the argument count is odd, the last one is the default.

Is a lookup table better?

Usually, once the mapping exceeds about six cases — a table plus XLOOKUP can be edited without touching a formula.

Other ways people ask this

This guide also answers

  • excel switch formula