SWITCH function in Excel

The SWITCH function is also one of the fairly common functions in Excel, so in the following article, Taimienphi.vn will give you some useful information and some examples that describe the SWITCH function in Excel.

Out SWITCH function in Excel, readers can refer to some other articles on Taimienphi.vn to learn about other functions in Excel like DVARP function in Excel.

Description of the SWITCH function in Excel

The SWITCH function in Excel compares the provided value with the supplied test expression and returns the result corresponding to the first matching value with the test expression. The default value provided will be returned if no value is provided that matches the test expression.

The syntax of the SWITCH function in Excel is:

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

In which the argument makes sense:

Expression: Expression or value compared to each value provided.

value1 and [value2], : Values ​​are compared with the provided expression.

result1 and [result2],: Results are returned if the corresponding value matches the supplied expression.

[default]: Returns the default value if no supplied value matches the given expression.


– You can enter up to 126 pairs of values ​​and results into the SWITCH function in Excel.

– If no default value is provided and no supplied value matches the provided expression, the Switch function will return the # N / A error message.

– The Switch function was introduced in Excel 2016, so it is not available in earlier versions of Excel. Also, the Switch function is not available in Excel 2016 for Mac.

Some examples of SWITCH function in Excel

The Excel Switch example below returns the name of the person corresponding to the number stored in column A in the worksheet. If the number in column A does not match one of 1-3, the function returns the text string “Invalid Subject Number”.


ham switch in excel 2


ham switch in excel 3

Error of the Switch function in Excel

If you get an error returned from the Switch function in Excel, it may be because:

#NAME ?:: An error occurs if no supplied value matches the given expression and no default argument is supplied.

#NAME ?: The error occurs if you are using an earlier version of Excel (before Excel 2016), do not support the Switch function.

Above Taimienphi.vn has just provided you with information about the SWITCH function in Excel, one of the basic functions many users, hope after this article readers will have more knowledge about the basic functions in Excel Please.

Besides, you can learn about the COUNTIFS function, which is a conditional statistical function, the COUNTIFS function that is frequently used in work as well as current problems.


Add a Comment

Your email address will not be published. Required fields are marked *