SWITCH function - Zoho Sheet - Help Guide

SWITCH

Compares a given value or range with other given expressions, and returns a result corresponding to the first match.

 

Syntax

 

SWITCH(expression; test; value; [test1]; [value1] ...; [default])

expression: Any value or cell range to test. Eg., A2

test: The value to be compared with the given expression. Eg., 5

value: The value to be returned corresponding to the specified test conditions. Eg., "Excellent"

default: The result to be returned when there is no match. Eg., "Good"

 

Examples

 

Formula

Result

=SWITCH(A2;5;"Excellent";1;"Poor";"Good")

Good

=SWITCH(D2;"F";"Fail","Pass")

Pass


Get a hands-on experience of the function in the embedded range below. 



Possible Errors

 

Errors

Meaning

#N/A!

  • The function could not find the value it was asked to look for. Commonly occurs in VLOOKUP and similar functions.

  • There is no corresponding match, and no default value given.

#NAME!

  • The function name is incorrect or invalid.

  • The given defined name (if any) is invalid.

  • There is a typo in the defined name used in the function.

  • Double quotes are missing for text values in the function.

  • Colon missing in a cell range reference.

#VALUE!

  • The given argument's data type is incorrect or invalid.
    For example, the function =DATE(A1:A3) will return a #VALUE error when a text value is present in the range.

#REF!

  • The given cell reference is incorrect or invalid. This error may occur when a cell/range has been deleted, moved, or pasted over.

 

Similar Functions