Formualizer Docs
ReferenceFunctionsLogical (Extended) Functions

SWITCH

SWITCH: Returns the result corresponding to the first matching candidate value.

Summary

SWITCH(expression, value1, result1, [value2, result2], ..., [default]) compares expression against each candidate from left to right.

Remarks

  • Matching is case-insensitive for text values.
  • Numeric comparisons treat Int and Number values as compatible.
  • A trailing unmatched argument acts as the default result.
  • When no candidate matches and no default is supplied, returns #N/A.
  • Errors in expression propagate immediately.

Examples

Match a text label
Grid
CellValue
No inputs on Sheet1.
Formula
=
Result
Not evaluated yet.
Expected
2
Fall back to default
Grid
CellValue
No inputs on Sheet1.
Formula
=
Result
Not evaluated yet.
Expected
other

FAQ

Does SWITCH compare text case-sensitively?

No. Text comparisons are case-insensitive in this implementation.

What happens when nothing matches?

SWITCH returns the trailing default when provided; otherwise it returns #N/A.

Runtime metadata

Category

Logical Ext

Signature

SWITCH(arg1, arg2, ... argN: Any)

This function accepts a repeating argument pattern (min args: 3).

Arity

min 3, max variadic

Arguments

arg1

Any · Scalar

Caps

PURESHORT_CIRCUIT

Source

On this page