(Google Sheets Question) Search a text for specific text, then multiple if statements depending on what's there

by Chris McMahon   Last Updated January 09, 2018 15:03 PM

I've got a weird question,

First, here's what I've got so far, but it returns an error "Function REGEXEXTRACT parameter 2 value "My Text here" is not a valid regular expression."

=IF(REGEXEXTRACT(X8, $Y$1), SUBSTITUTE(W8,$Y$1, ""), 
 IF(REGEXEXTRACT(X8, $Y$2), SUBSTITUTE(W8,$Y$2, ""), 
    IF(REGEXEXTRACT(X8, $Y$3), SUBSTITUTE(W8,$Y$3, ""),
                    IF(REGEXEXTRACT(X8, $Y$4), SUBSTITUTE(W8,$Y$4, ""), ""
                    )
     )
   )
)

Basically, what I want it to do, is check if a cell contains certain text, with different results based on what text it finds. I have 4 possibilities of what it could find, let's say it Looks for Abc, def, ghi, jkl in a line of text. When it sees abc, it looks at W8, and substitutes W8 with $Y$1. If it sees def, it looks at W8, and substitutes W8 with $Y$2. Etc. Etc. Etc. And then Ideally it shows as blank if it doesn't find any of those.

I feel like i'm really close to getting it right, but I just can't see it.



Related Questions




How to get the data value of NOW() and stored as text

Updated December 22, 2017 17:03 PM