# How to use the SWITCH function in Excel 2019

In this article, we will learn about how to use the SWITCH function in Excel.

The SWITCH function returns the result based on some condition. This function works as like nested IF function.
Syntax:

=SWITCH (expression, val1/result1, [val2/result2], ..., [default])

Let’s understand how to use Excel Switch function to get results.

Here we have some of the code of the United States. The Swich Formula will get us their State Name.

Use the formula:

=SWITCH(RIGHT(A2,2),”UT”,”Utah”,”TX”,”Texas”,”OH”,”Ohio”,”?”)

Explanation:
Here Right function extracts the last 2 index of the cell to match with area code in formula and returns the State name corresponding to it and returns “?” if no state is matched.

As you can see from the above examples that how to use SWITCH function in Excel.

Hope you understood how to use the SWITCH function in Excel. Explore more articles on Excel Logic_test function. Please state your queries in the comment box below. We will help you.

Related Article:

How to Use Nested IF Function in Excel

How to use the CHOOSE Function in Excel

The Excel IF Function

Popular Articles:

50 Excel Shortcuts to Increase Your Productivity

How to use the VLOOKUP Function in Excel

How to use the COUNTIF function in Excel 2016

How to Use SUMIF Function in Excel

Terms and Conditions of use

The applications/code on this site are distributed as is and without warranties or liability. In no event shall the owner of the copyrights, or the authors of the applications/code be liable for any loss of profit, any problems or any damage resulting from the use or evaluation of the applications/code.