Logical · exact-match dispatch · Nov 2026

The SWITCH function,
matched & dispatched.

One expression, a list of values, the first match wins. Syntax, a live status-code playground, the exact-equality rule, the #N/A default trap, and how SWITCH differs from IFS — plus the errors people actually hit, sourced and fixed.

D1
fx
=SWITCH(A2, 1, "New", 2, "Open", 3, "Closed", "Unknown")
0
max values
0
sourced errors fixed
0
platforms checked
Syntax

SWITCH, argument by argument

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

ArgumentRequiredWhat it does
expressionyesThe value compared against each listed value — a cell, a number, text, or a formula.
value1…value1261+ pairsValues compared to expression with exact equality. Up to 126 of them.
result1…result1261+ pairsReturned when the paired value is the first exact match.
defaultnoA final argument with no paired result; returned when nothing matches. Omit it and unmatched codes give #N/A.

Text matching is case-insensitive; number and text values are distinct types. The first matching value wins, so duplicate values later in the list are never reached.

Original data · the moat

How SWITCH actually matches

Behavior measured in a real formula engine — not copied from a docs page. SWITCH compares one expression against each value with exact equality and returns the first match's result. Three rules decide what you get:

Method: HyperFormula 3.5 live evaluation of SWITCH dispatch, default, case and type behavior on the playground grid. Reproducible; engine-measured, not transcribed.

// 03 — Try it live

Interactive SWITCH playground

Edit the code/status data, then load a preset to see exact dispatch, the #N/A default, case-insensitivity, text≠number, duplicate first-match, or the SWITCH(TRUE()) range trick. Runs on a real engine — no add-in.

A1Sample data — click any cell to edit, the formula re-evaluates live
Result
—
✓ readyHyperFormula 3.5
// 04 — Error library

The real-world error library

10 failure patterns mined from actual user reports on Reddit, Stack Overflow and Super User — each with the authentic symptom, root cause, a fix, and a runnable formula. Not textbook theory.

// 05 — Cross-platform

Where SWITCH works

SWITCH is modern (2019+/365). Older Excel returns #NAME?. Here's the exact support across 8 platforms, plus the nested-IF fallback.

PlatformSupportNotesGotcha
✓ Supported full SWITCH◐ Partial works with caveatsCompiled from public docs · verify against your build
Go deeper

The Logical Functions course

SWITCH, IFS, IF, IFERROR, AND/OR/NOT — when to dispatch on exact values, when to band ranges, and how to keep formulas readable. Video walkthroughs + downloadable workbooks.

Join the courseCompare with IFS
// 07 — FAQ

Frequently asked