Skip to content
Google Sheets

SWITCH function in Google Sheets

Tests an expression against a list of cases and returns the corresponding value of the first matching case, with an optional default value if nothing else is met.

=SWITCH(expression, case1, value1, [case2, value2, ...], [default])

SWITCH syntax and parameters

Six arguments, three required.

  • expressionanyRequired

    Any valid values.

  • case1anyRequired

    The first case to be checked against expression.

  • value1anyRequired

    The corresponding value to be returned if case1 matches expression.

  • case2anyOptional
  • value2anyRepeating
  • defaultanyOptional

    Optional: An optional value, specified as the last parameter, to be returned if none of the cases match the expression.

SWITCH examples

Formulas you'll actually reuse.

  1. Commission rate by region, with a default for everything else:

    =SWITCH(A2, "West", 0.08, "North", 0.07, "South", 0.06, 0.05)

    Result0.08

  2. Weekend or weekday from a date — several cases, one fallback:

    =SWITCH(WEEKDAY(E2, 2), 6, "Weekend", 7, "Weekend", "Weekday")

    Result"Weekday"

SWITCH in Excel

Same name — your formula ports as-is.

Try SWITCH in the playground

Edit the example — nothing to install.

Preloaded with the SWITCH formula from Example 1 — change anything and watch it respond.

Loading the editor…

SWITCH errors

What they mean — and the fixes.

  • #N/A

    No case matched and no default was given — add a final unpaired argument as the fallback.