SWITCH Function

Excel 2019+, Microsoft 365

Summary

The Excel SWITCH function matches an expression against multiple values and returns the corresponding result for the first match. It provides a cleaner alternative to nested IF statements for exact value matching scenarios.

Syntax

SWITCH(expression, value1, result1, [value2, result2, ...], [default])

Parameters

Parameter Type Required Description
expression Any Yes The value (number, text, date) to compare against value arguments
value1 Any Yes First comparison value
result1 Any Yes Result if expression matches value1
[value2, result2, ...] Any No Optional additional value-result pairs
[default] Any No Optional default result if no matches found

Using the SWITCH Function

SWITCH simplifies multiple exact-match conditions that would otherwise require nested IF statements. It's ideal for converting numeric codes to text descriptions, mapping status values, or handling weekday numbers.

Common SWITCH Examples

Weekday Name Conversion

=SWITCH(WEEKDAY(A2),1,"Sunday",2,"Monday",3,"Tuesday",4,"Wednesday",5,"Thursday",6,"Friday",7,"Saturday")

Converts weekday number (1-7) to day name. WEEKDAY(A2) returns 2, so outputs "Monday".

Grade Mapping

=SWITCH(B2,90,"A",80,"B",70,"C",60,"D","F")

Converts numeric score in B2 to letter grade. Returns "F" if score < 60.

Status Code Translation

=SWITCH(C2,"P","Pending","A","Approved","R","Rejected","Unknown")

Translates status codes: P→Pending, A→Approved, etc. Defaults to "Unknown".

No Default (Error Case)

=SWITCH(D2,1,"One",2,"Two")

Returns #N/A error if D2 is not 1 or 2 (no default provided).

Frequently Asked Questions

#N/A error is returned.

Yes, SWITCH performs exact case-sensitive matching for text values.

Yes, dates work as long as the expression and value arguments use the same date format.

Up to 126 value-result pairs (254 arguments total).

Common Errors and Solutions

#N/A error

Cause: No matching value found and no default provided

Solution: Add a default value as the final argument

#VALUE! error

Cause: Mismatched value-result pairs (odd number of arguments after expression)

Solution: Ensure value-result pairs are complete and default is last

Too many arguments

Cause: Exceeding 254 total arguments

Solution: Reduce number of value-result pairs

Notes

  • Exact matching only - no wildcards or range matching
  • Text comparisons are case-sensitive
  • Default must be final argument with no corresponding result
  • Up to 126 value-result pairs due to 254 argument limit
  • Faster than nested IF for multiple conditions

Compatibility

Available in: Excel 2019, Excel 2021, Microsoft 365

Not available in: Excel 2016 and earlier versions

Content last reviewed: December 9, 2025
Update frequency: As needed
Excel versions tested: Excel 2019+, Microsoft 365