ExcelFlux

SWITCH function

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.

Logical · Excel 2019+

Where can you use it?

Teams building reports and business rules. Adapt the example’s decision rule when you need to test a condition or display different results based on it.

Scenario in the workbook

Turn status codes into labels. Unmatched codes return the final default.

A worked example from the workbook

RowA
6Value
71
82
99
Record 1
=SWITCH(A7,1,"Open",2,"Closed","Review")

Expected resultOpen

See the inputs and instructions for all 3 examples

Copyable formulas

English Excel · en-US
=SWITCH(2,1,"Open",2,"Done","Other")
Turkish Excel · tr-TR
=İLKEŞLEŞEN(2;1;"Open";2;"Done";"Other")

Expected result

“Done”

Worked examples

Turn status codes into labels. Unmatched codes return the final default.

Open the English sheet. Inputs begin at A6. F7:F9 show the live results and G7:G9 show the original results for comparison.

Row A
6 Value
7 1
8 2
9 9
Case Formula Expected result
Record 1 =SWITCH(A7,1,"Open",2,"Closed","Review") Open
Record 2 =SWITCH(A8,1,"Open",2,"Closed","Review") Closed
Record 3 =SWITCH(A9,1,"Open",2,"Closed","Review") Review
Microsoft Excel reference