Excel: SWITCH Function

Share this video:

About the video

SWITCH

This function in Excel compares one value against a list of values, and returns a result corresponding to the first match found. When no match is found, SWITCH can return an optional default value. You can use the SWITCH function when you want to perform a "self-contained" exact match lookup with several possible results. When no match is found, SWITCH can return an optional default value. The first argument in SWITCH is called "expression" and can be a hard-coded constant, a cell reference, or a formula that returns a specific value to match against. Matching values and corresponding results are entered in pairs. SWITCH can handle up to 126 pairs of values and results. The last argument, default, is an optional value to return when there is no match.

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. SWITCH only performs an exact match, so you can't include logical operators like greater than (>) or less than (<) in the logic used to determine a match. You can work around this limitation by constructing a formula to match against TRUE
 

Arguments of SWITCH Function:

  • 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.


 

Share this video: