IF Cell Contains Text Generator
Return one value when a cell contains a piece of text, and another when it does not.
IF Cell Contains
Return one value when a cell contains a piece of text, and another when it does not.
The fragment to search for. Needs quotes, or point at a cell.
The cell whose text is being checked.
Returned when the text appears anywhere in the cell.
Returned otherwise. Use "" for a blank cell.
=IF(ISNUMBER(SEARCH("urgent", A2)), "Yes", "")Worked Example
A support log with subject lines in column A, flagging anything mentioning "refund".
=IF(ISNUMBER(SEARCH("refund", A2)), "Refund", "")Returns: Shows "Refund" for a subject like "Please process my refund", and stays blank otherwise. Case does not matter.
Checks Before You Paste
- •SEARCH ignores case, so "urgent" also matches "Urgent" and "URGENT". Swap SEARCH for FIND if you need the match to be case-sensitive.
- •The ISNUMBER wrapper is what makes this work: SEARCH returns the position of the match, or a #VALUE! error when there is none, so testing it directly with IF would surface the error instead of FALSE.
- •SEARCH accepts wildcards - "a?c" matches one character between a and c, and "a*c" matches any run. To find a literal ? or *, prefix it with a tilde.