Excel SWITCH Function

This post will guide you how to use Excel SWITCH function with syntax and examples in Microsoft excel.

Description

The Excel SWITCH function compares one value against a list of values, and returns the result corresponding to the first matching value. A default value can be returned if none of the supplied values match the test value.

The SWITCH function is a build-in function in Microsoft Excel and it is categorized as a Logical Function.

The SWITCH function is available in Excel 2016.

Syntax

The syntax of the SWITCH function is as below:

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

Where the SWITCH function arguments are:

  • Expression -This is a required argument.  The expression or a value that is to be compared.
  • value1, values2,… valuen – The value that will be compared against expression.
  • result1, result,… result – The value that to be returned when the corresponding value argument matches expression.
  • default -This is an optional argument.  The default value to be used when no matching is found.

Excel SWITCH Function Examples

The below examples will show you how to use Excel SWITCH Function to compare one value against a list of values and returns a result corresponding to the first match.

1# =SWITCH(B1,1,”Sunday”,2,”Monday”,3,”Tuesday”,”none”)

If the value in Cell B1 is equal to 1, it returns “Sunday”, and if it is equal to 2, then returns “Monday”, or if it is equal to 3, then returns “Tuesday”, otherwise, return “none”.

Leave a Reply