Excel guide · 3 min read
If a cell contains text, return a value in Excel
Use =IF(ISNUMBER(SEARCH("wireless",A2)),"Yes","No"). SEARCH returns the position of the word if it appears anywhere in A2 and an error if it does not; ISNUMBER turns that into TRUE or FALSE for IF. SEARCH ignores case; use FIND for a case-sensitive check.
Sample data
Every formula on this page was calculated live against this sheet.
| A | B | C | |
|---|---|---|---|
| 1 | Product | Price | Notes |
| 2 | Wireless Mouse M220 | 24.99 | Refund issued |
| 3 | USB-C Charging Cable | 12.5 | |
| 4 | Mechanical Keyboard | 89 | Back order |
| 5 | Wireless Keyboard K380 | 39.99 | |
| 6 | HDMI Cable 2m | 9.99 | refund pending |
| 7 | Laptop Stand | 34 |
The standard formula: IF + ISNUMBER + SEARCH
A simple =IF(A2="wireless", ...) only matches when the whole cell is exactly "wireless". To find a word anywhere inside the cell, you need SEARCH.
SEARCH("wireless",A2) returns 1 for "Wireless Mouse M220" because the word starts at character 1. For "Laptop Stand" it returns #VALUE!. ISNUMBER converts those to TRUE and FALSE, and IF picks the result.
Result: Wireless
A2 contains "Wireless" (case does not matter to SEARCH), so the result is Wireless.
Return a number from another cell
The value you return can be anything: text, a number, or another cell. This returns the price when the note mentions a refund and 0 otherwise, so you can total refunds with SUM.
Point SEARCH at a cell instead of typing the word, for example SEARCH($F$1,C2), and you can change the keyword without touching the formula.
Result: 24.99
C2 says "Refund issued", so the formula returns the price from B2: 24.99.
Case-sensitive check with FIND
FIND works like SEARCH but cares about upper and lower case, and it does not support wildcards. Use it when "USB" and "usb" mean different things in your data.
Result: Has USB
A3 contains "USB" in capitals, so FIND returns a position and the result is Has USB.
Check for one of several words
Wrap one ISNUMBER(SEARCH()) per word inside OR. The cell is flagged if any of them appears. Swap OR for AND when every word must appear.
Result: Cable
A6 is "HDMI Cable 2m". The HDMI test is TRUE, so OR is TRUE and the result is Cable.
Count cells that contain a word
If you need a count rather than a label on each row, COUNTIF with asterisk wildcards does it in one cell. The asterisk means "any characters", so "*keyboard*" matches the word anywhere in the cell. COUNTIF also ignores case.
Result: 2
Two products contain "keyboard": the mechanical one and the K380.
Which method to pick
Need a label or value on each row? Use IF with ISNUMBER and SEARCH. Need it to respect capitals? Swap SEARCH for FIND. Need a single total? COUNTIF or SUMIF with "*word*" is shorter and does not need a helper column. In Excel 365, FILTER can pull out every matching row at once if you want a list rather than a flag.
Whichever you choose, keep the keyword in its own cell and refer to it. Then anyone can change what is being searched for without editing formulas.
Common mistakes
Using wildcards with an equals sign
=IF(A2="*wireless*", ...) looks for a literal asterisk. Wildcards only work inside functions like COUNTIF, SUMIF and XLOOKUP. Use ISNUMBER(SEARCH()) in IF.
Short keywords matching inside other words
Searching for "cab" also matches "cable". Add spaces around the keyword or search a longer phrase if that matters.
Leaving out ISNUMBER
=IF(SEARCH("x",A2),...) returns #VALUE! whenever the word is missing, because the error passes straight through IF.
FAQ
How do I check if a cell contains any text at all?
Use =IF(ISTEXT(A2),"Text","Not text"). ISTEXT is TRUE for any text, including numbers stored as text, and FALSE for real numbers and empty cells.
Is SEARCH case-sensitive?
No. SEARCH ignores case and allows wildcards. FIND is the case-sensitive version.
Can I highlight cells that contain a word instead?
Yes. Select the range, then Home > Conditional Formatting > Highlight Cells Rules > Text that Contains, and type the word.
Functions used
IFPicks a result from a testISNUMBERIs it a number?SEARCHPosition of textFINDPosition of text (case-sensitive)ORTrue if any test is trueCOUNTIFCounts cells that matchISTEXTIs it text?
Keep learning
- How to sum if a cell contains text in Excel
- How to count cells with text in Excel
- How to use IF with AND and OR in Excel
Updated 2026-10-31