How to use the SWITCH() function for Excel.
SWITCH() allows you to match a series of values and output a value based on that match - this replaces basic nested IF statements in Excel.
This tutorial covers the syntax of the switch function and shows you how to use it. As well, 3 robust alternatives to the switch function are also covered and explained.
The benefit to showing you this function and its alternatives is to allow you to have the tools that you need to use the best formula for the job. Sometimes you may want a complex setup that is more robust and versatile and utilizes a VLOOKUP() and a lookup table and sometimes you want an old-school IF statement and sometimes, the new SWITCH() function is the perfect tool for the job.
=SWITCH(Value to switch, Value to match1...[2-126], Value to return if there's a match1...[2-126], Value to return if there's no match)
=SWITCH(A4,1,"Good",2,"Ok",3,"Bad","Not Allowed")
A4 is the cell with the value to check.
1 is the first value to check for.
Good is the value to output if cell A4 contains 1
This pattern is followed until the last argument, which is what is output if there is no match found.
Not Allowed is the default value that is output if no match is found.
15 IF Statement Examples in Excel
5 Bite-Size Vlookup Tricks for Excel