Want to know How To Master the SWITCH Function in Excel?
*** Watch our video and step by step guide below with free downloadable Excel workbook to practice ***
What does it do?
Matches multiple values and returns the first value that has a match
=SWITCH(expression, value1, result1, [value2 / default, result2], …)
What it means:
=SWITCH(value to check, value to match against, result to return, [succeeding values to match or the default value if nothing gets matched], …)
If you have multiple values to check, we can use Excel’s SWITCH Formula! It allows us to specify multiple values to check, then the SWITCH Formula will look for the first value that gets matched!
Let us try it out on a simple ratings table (e.g. 1 = Bad, 2 = Average, 3 = Great), then we will create a SWITCH Formula that will simulate the exact same logic of the table!
I explain how you can do this below:
STEP 1: We need to enter the SWITCH function in a blank cell:
STEP 2: The SWITCH arguments:
What is the value to check?
Select the cell containing the rating that you want to translate to the correct description
What is the first lookup value and value to return if it is matched?
Let us start from the first value of the rating table. If the value is 1, then the description is “Bad”
=SWITCH(G8, 1, “Bad”
What is the second lookup value and value to return if it is matched?
Let us start from the second value of the rating table. If the value is 2, then the description is “Average”
=SWITCH(G8, 1, “Bad”, 2, “Average”,
What is the third lookup value and value to return if it is matched?
Let us start from the third value of the rating table. If the value is 3, then the description is “Great”
=SWITCH(G8, 1, “Bad”, 2, “Average”, 3, “Great”,
What is the default value to return if nothing gets matched?
We want to show the value “Unknown”, if an unknown rating is specified.
=SWITCH(G8, 1, “Bad”, 2, “Average”, 3, “Great”, “Unknown”)
You now have your correct rating description!
Let us try an unknown rating (40) and see the resulting description:
How to Use the SWITCH Formula in Excel