Google sheets, if statement multiple conditions

Viewed 43271

Trying to make an if statement that will return 4 outcomes based on the contents of the cell

If the cell is "Yes", "No", "NA", "Unknown", to return 0, 1, 2, 3 respectively.

I can use If(A1="Yes", 0,1) but not sure how to handle the other conditions

3 Answers

SWITCH would be a better call:

=SWITCH(A1,"Yes",0,"No",1,"N/A",2,"Unknown",3,"I'-'I")

Please try:

=IF(A1="Yes",0,IF(A1="No",1,IF(A1="Unknown",3,2)))

Anything other than the given selection in A1 (and not an error) and the formula would return 2.

The concept you are asking for in the Google Docs Editors help center is called "nested function". This concept refers to using a function as a parameter of another function.

The syntax for IF is

IF(logical_expression, value_if_true, value_if_false)

You could replace logical_expression, value_if_true and/or value_if_false with another IF. For this specific case, try

=IF(A1="Yes",0,IF(A1="No",1,IF(A1="NA",2,IF(A1="Unknown",3,NA())))

#N/A will be returned if A1 contains an unexpected value.

Reference

Related