# Excel SWITCH Function

The SWITCH function compares one value against a list of values, and returns a result corresponding to the first match. SWITCH takes an optional default value which is used when no match is found.

**expression**- The value or expression to match against.**val1/result1**- The first value and result pair.**val2/result2**- [optional] The second value and result pair.**default**- [optional] The default value to use when no match is found.

Use the SWITCH function to match a value of expression agains several possibilities and return a result corresponding to the first matching value. In the example shown, the formula in D5 is:

=SWITCH(C5,1,"Poor",2,"OK",3,"Good","??")

The first argument is called "expression" and can be a hardcoded constant, a cell reference, or another formula that returns a specific value you want to match against. Matching values and results are entered in value/result pairs. SWITCH can handle up to 126 matches. A optional final argument specifies a default result to return in cases where there is no match.

### SWITCH versus IFS

Like the IFS function, the SWITCH function allows you to test more than one condition without nesting, making formulas with many conditions easier to read and create. One advantage of SWITCH over IFS is that the expression appears just once in the function and does not need to be repeated. However, SWITCH is limited to exact matching. It's not possible to use operators like greater than (>) or less than (<) in the logic used to determine a match in cases where there likely will not be an exact match, for example when assigning grades with a formula.

*Note: the SWITCH function is new in Excel 2016 via Office 365.*

Notes:

- Expression can be another formula that returns a specific value.
- SWITCH can handle up to 126 value/result pairs.
- Enter a final argument to set a default result when no match is found.

## Excel Formula Training

Formulas are the key to getting things done in Excel. In this accelerated training, you'll learn how to use formulas to manipulate text, work with dates and times, lookup values with VLOOKUP and INDEX & MATCH, count and sum with criteria, dynamically rank values, and create dynamic ranges. You'll also learn how to troubleshoot, trace errors, and fix problems. Instant access. See details here.