Check cell for a specific letter or set of letters

user1799724 picture user1799724 · Nov 5, 2012 · Viewed 320.5k times · Source

In a Google Spreadsheet, I want to use a formula that will output a certain text or number if a certain cell contains certain letters.

For example, if I put =IF(A1="Black";"YES";"NO") and A1 is equal to "Black" - it outputs "YES" correctly. However when I put =IF(A1="Bla";"YES";"NO") it outputs "NO". Is there any formula that I can use that I can say something like =IF(A1 CONTAINS "Bla";"YES";"NO") so it outputs "YES".

Answer

flyingjamus picture flyingjamus · Nov 28, 2012

You can use RegExMatch:

=IF(RegExMatch(A1;"Bla");"YES";"NO")