To check if a cell contains specific text, use ISNUMBER and SEARCH in Excel. There's no CONTAINS function in Excel. 1. To find the position of a substring in a text string, use the SEARCH function.
You can use RegExMatch
:
=IF(RegExMatch(A1;"Bla");"YES";"NO")
Some options without REGEXMATCH
, since you might want to be case insensitive and not want say blast
or ablative
to trigger a YES
. Using comma as the delimiter, as in the OP, and for the moment ignoring the IF condition:
First very similar to @user1598086's answer:
=FIND("bla",A1)
Is case sensitive but returns #VALUE! rather than NO
and a number rather than YES
(both of which can however be changed to NO/YES respectively).
=SEARCH("bla",A1)
Case insensitive, so treats Black
and black
equally. Returns as above.
The former (for the latter equivalent) to indicate whether bla
present after the first three characters in A1:
=FIND("bla",A1,4)
Returns a number for blazer, black
but #VALUE!
for blazer, blue
.
To find Bla
only when a complete word on its own (ie between spaces - not at the start or end of a 'sentence'):
=SEARCH(" Bla ",A1)
Since the return in all cases above is either a number ("found", so YES
preferred) or #VALUE!
we can use ISERROR to test for #VALUE!
within an IF formula, for instance taking the first example above:
=if(iserror(FIND("bla",A1)),"NO","YES")
Longer than the regexmatch
but the components are easily adjustable.
You can use the following formula,
=IF(ISTEXT(REGEXEXTRACT(A1; "Bla")); "Yes";"No")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With