Google-sheets – If cell contains then

formulasgoogle sheets

I need to create a formula that will check for a word in a cell and return a value or if the word does not exist then check for another word.

Eg. Check Cell A1 contains the word "red" then print "RED" if A1 does not contain the word "red" then check if A1 contains the word "blue" and print "BLUE".
If A1 does not contain the word "red" or "blue" then leave empty.

Something like: =IF(A1 Contains "red","RED",If A1 Contains "blue","BLUE,"")

Best Answer

  • with IF()

    =IF(A1="red",  "RED",
     IF(A1="blue", "BLUE", ))

  • with IFS()

    =IFERROR(IFS(A1="red",  "RED",
                 A1="blue", "BLUE"), )