How to use Switch function in Excel

The "SWITCH" function in Excel is a new function introduced in Excel 365 and can be used to evaluate a list of conditions and return a corresponding value for the first matching condition. It is similar to the "IF" function, but it provides a simpler syntax for evaluating multiple conditions.

Here's the basic syntax for the "SWITCH" function:

SWITCH(expression, value1, result1, [value2, result2], ... [default or value_n, result_n])

Where:

  • expression: The expression that you want to evaluate.
  • value1: The first value to be compared with the expression.
  • result1: The corresponding result if expression is equal to value1.
  • value2, result2, ...: Optional additional pairs of values and results.
  • default: The result if none of the values match the expression.

Here's an example of using the "SWITCH" function to evaluate a score and return a corresponding grade:

=SWITCH(A1, 90, "A", 80, "B", 70, "C", 60, "D", "F")

In this example, the expression is the value in cell A1. If the value in A1 is 90, the function returns "A". If the value in A1 is 80, the function returns "B", and so on. If the value in A1 does not match any of the values specified, the function returns "F".

Note: The "SWITCH" function is not available in earlier versions of Excel. In those versions, you can use the "IF" function to evaluate multiple conditions.