Choosing Cases With SWITCH
Map an input to one of several results using SWITCH.
Why SWITCH Exists
When you are comparing one value against a list of exact possibilities, nested IFs get repetitive. You keep typing the same cell reference over and over.
The SWITCH function solves this. You name the value once, then list each possible match alongside the result it should produce. It reads like a clean lookup table written inside a single formula.
The SWITCH Syntax
The structure is: SWITCH(expression, value1, result1, value2, result2, ..., default).
- expression is the thing you are evaluating, usually a cell.
- Then you pair each possible value with its result.
- An optional default at the end catches anything that did not match.
The values come in pairs, with a lone default allowed at the very end.
=SWITCH(A2, "N", "North", "S", "South", "Unknown")All lessons in this course
- Stacking IFs for Multiple Outcomes
- Choosing Cases With SWITCH
- Picking Items With CHOOSE
- Keeping Complex Logic Readable