Skip to content
Klargrid

The SWITCH function

"If the code is A, return Active; if S, Suspended; otherwise Unknown": one test, several answers, no nested IFs.

Syntax

=SWITCH(expression, value1, result1, [value2, result2], …, [default])

In a French Excel: =SI.MULTIPLE(expression; valeur1; résultat1; [valeur2; résultat2]; …; [par_défaut]).

Arguments

  • expression: the value to compare.
  • value1, result1…: case and answer pairs.
  • default: the answer when no case matches.

An example

=SWITCH(B2,"A","Active","S","Suspended","C","Closed","Unknown")

The status label, "Unknown" for an unexpected code.

Pitfalls

  • Without a default, an unexpected case returns #N/A.
  • Equality only: for "greater than", IFS.

Going further

Frequently asked questions

In which versions?
Excel 2019 and later, and Microsoft 365.