Google Sheets – Compare Single Cell to Multiple Values

formulasgoogle sheets

I have a cell in a spreadsheet that can have virtually any value. However, if that cell has one of four different values, I want a different cell to display certain text.

Right now I have this:

=IF(OR(A1="Cyan",A1="Magenta",A1="Yello",A1="Key"),"CMYK","Other")

Is there a simpler (less verbose) way to compare A1 to those values?

I looked at IFS() and SWITCH(), but they don't seem to be any less verbose.

Best Answer

For the specific case on the question it looks to me that the formula included already has the simpler formula

=IF(OR(A1="Cyan",A1="Magenta",A1="Yello",A1="Key"),"CMYK","Other")

as the alternatives are more complex in one or another way.

IFS and SWITCH are pretty new Google Sheets built-in functions. Side-note: their help articles are not translated yet to Spanish. If they were found to not be any less verbose, then the following examples of alternatives will not found any less verbose either.

  • Using MATCH returns a number or an error and it requires that its second argument to be an array or a reference to a range. If it doesn't found the input value, it will return an error so it use for this case implies a way to catch the error.
  • Using VLOOKUP also requires that its second argument to be an array or a reference to a range. Also if it doesn't found the input value, it will return an error so it use for this case implies a way to catch the error.
  • The use of REGEXMATCH to be considered "simpler" implies that the formula writer feels comfortable writing regular expressions and that simpler doesn't mean shorter, as the resulting formula will be larger than the above formula.