Contact

SWITCH Function in Microsoft Excel: Syntax, Examples & Compatibility

Logical Beginner Microsoft Excel

Learn how to map a code to a label without a chain of nested IF formulas in Microsoft Excel. Includes syntax, two verified-by-reasoning results, troubleshooting and portability notes.

Verification status: See the evidence and test scope described in this guide. How formula examples are checked

Quick answer: map a code to a label without a chain of nested IF formulas in Microsoft Excel. The reproducible examples below use explicit values so the formula’s meaning is testable without a large workbook.

Evidence: The function name and syntax are documented in the linked vendor function reference. Expected outputs were independently reasoned or checked outside the application. These are not native Microsoft Excel test results. A guide being published here does not certify every software release or file-import scenario.

Availability and version history

  • Introduced: Announced February 23, 2016 as a new Office 365 function; the original numeric build is not established. Microsoft release announcement.
  • Availability: Official help lists Excel for Microsoft 365, Excel for Microsoft 365 for Mac, Excel 2024, Excel 2024 for Mac, Excel 2021, Excel 2021 for Mac, Excel 2019.
  • Checked: October 14, 2026; official SWITCH reference. Documentation check, not a new native test; existing example-verification notes retain their scope.

Syntax and arguments

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

expression is compared to each case value. Optionally supply a final default when no case matches.

Best use case: Map a code to a label without a chain of nested IF formulas.

Set up the example sheet

Imagine order data containing country codes CA, US and other values. Work with literal codes first to make it easy to spot spelling problems.

Enter the formula in an unused cell. For a formula returning several values, leave an unobstructed area where those values can expand. These formulas use comma argument separators in a typical English-language locale; commas or semicolons inside quoted text are data, not argument separators. Adapt the separator if your regional settings require it.

Worked example 1: SWITCH with known input

=SWITCH("CA","CA","Canada","US","United States","Other")

Expected output: Canada.

The first case matches CA and returns the matching label.

Worked example 2: a second SWITCH case

=SWITCH("MX","CA","Canada","US","United States","Other")

Expected output: Other.

Neither listed case matches MX, so the final default is returned.

Compare both results before replacing literal values or short sample ranges with your own workbook data. For a spilling formula, compare every output cell, not only the top-left result.

Advanced example: distinguish a default from a matched result

With an order code in A2, use:

=SWITCH(A2,"NEW","Queue","HOLD","Review","DONE","Archive","Unknown code")

For NEW, HOLD, DONE and OTHER, the expected results are Queue, Review, Archive, Unknown code. The final unpaired argument is the default. Each earlier case value has a corresponding result.

Without that final default, an unmatched code produces Microsoft’s documented #N/A. If a value appears twice, the first match determines the result: =SWITCH("HOLD","HOLD","First","HOLD","Second","Other") returns First.

SWITCH compares an expression with case values. IFS is usually clearer for ordered inequalities such as 90-or-more and 60-or-more. Do not write a Boolean comparison where a literal case value was intended and assume both functions interpret the structure identically.

Microsoft documents up to 126 value/result pairs within the function’s argument limit. A growing operational code map may be easier to maintain in an explicit lookup table. Preserve input codes and review unexpected labels before silently normalizing meaningful punctuation or spacing.

Practical advice and troubleshooting

When this formula helps: Use SWITCH for equality-based mappings; use IFS when the conditions involve inequalities, ranges or multiple booleans.

Important edge case: Leading/trailing spaces in imported codes cause otherwise sensible mappings to miss. Clean codes before comparing.

If the result differs, first verify the text-versus-number types of the input cells, the argument separators for your locale, and the range size. For dynamic arrays, inspect occupied cells in the output area. An error that looks like a missing function may reflect a software version rather than incorrect data.

Compatibility and version considerations

The function name is shared by Excel and Sheets; availability in older workbook versions is a separate concern.

Check your installed release for availability and dynamic-array support.

Microsoft’s dedicated reference specifies Office 2019 or a Microsoft 365 subscription for Windows/Mac availability. The 2016 subscription announcement does not establish perpetual Excel 2016 support.

Editorial verification: Direct function documentation reviewed October 14, 2026. The two example outputs are independently reasoned; no native application run, screenshot, or version-specific output is claimed. Review the editorial testing standards if you require stronger proof before importing a workbook.