Contact

SWITCH Function in Google Sheets: Syntax, Examples & Compatibility

Logical Beginner Google Sheets

Learn how to map a code to a label without a chain of nested IF formulas in Google Sheets. 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 Google Sheets. 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 Google Sheets test results. A guide being published here does not certify every software release or file-import scenario.

Availability and version history

  • Introduced: Introduction version not established by the official history reviewed.
  • Availability: Documented in the rolling Google Sheets service; examples use the web spreadsheet workflow.
  • 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.

Distinguish a case result from the optional default

For a fictional order code in A2:

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

For NEW, HOLD, DONE, OTHER, expected results are Queue, Review, Archive, Unknown code. Every listed case has a paired result; the final unpaired value is the optional default for unmatched codes.

Google documents selection of the first matching case. Thus =SWITCH("HOLD","HOLD","First","HOLD","Second","Other") has expected result First. Duplicate cases can hide an unintended later mapping, so inspect the case list rather than assuming every listed result can be reached.

A default is a reporting decision. Unknown code preserves evidence that an input was not in the map; replacing every unmatched value with a normal status can conceal a changed source schema. Keep the original code visible next to the label.

Use IFS when rules are ordered inequalities, such as a value at least 90. SWITCH compares one expression with case values; putting a comparison where a literal code belongs changes the structure of the calculation.

These are text-only controls with a stated default. The checked Google page does not provide a complete coercion or omitted-default error table, and no numeric/date or Unicode comparison boundary was natively tested here. A long operational code list may be easier to maintain in a dedicated lookup table with reviewed keys.

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. For an imported workbook, inspect whether the function name or syntax changed during conversion before attributing an error to the source values.

Compatibility and version considerations

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

Google Sheets is a rolling service. Check the current web-file locale and any imported-formula changes; a desktop release number does not identify the Sheets calculation environment.

Function availability and parameter behavior must be judged for the specific application and release; a function documented in one spreadsheet does not automatically work in another.

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.