Skip to content
ExcelExcel 2019+

SWITCH function in Excel

Evaluates an expression against a list of values and returns the result corresponding to the first matching value. If there is no match, an optional default value may be returned.

=SWITCH(expression, value1…value126, result1…result126, [default])

SWITCH syntax and parameters

Four arguments, three required.

  • expressionanyRequired

    Expression is the value (such as a number, date or some text) that will be compared against value1…value126.

  • value1…value126anyRepeating

    ValueN is a value that will be compared against expression.

  • result1…result126anyRepeating

    ResultN is the value to be returned when the corresponding valueN argument matches expression. ResultN and must be supplied for each corresponding valueN argument.

  • defaultanyOptional

    Default is the value to return in case no matches are found in the valueN expressions. The Default argument is identified by having no corresponding resultN expression (see examples). Default must be the final argument in the function.

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 Google Sheets

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.