Excel Substring Contains: Find Text in Cells
In this article
To check whether a cell contains a substring in Excel, use =ISNUMBER(SEARCH("text", A1)). This returns TRUE if the substring appears anywhere in the cell, ignoring case, and FALSE if it does not. For a case-sensitive check, replace SEARCH with FIND. That is the whole answer; the rest of this guide covers how to use it in filters, conditional formatting, and combined formulas, plus what to do when it misbehaves.
What You'll Need
- Excel 2016 or later, Microsoft 365, or Excel for the web. The functions used here (SEARCH, FIND, ISNUMBER, IF) are available in all modern versions.
- A worksheet with text data in a column, and a blank column beside it for the formula.
- Basic familiarity with entering formulas and dragging the fill handle.
Step-by-Step
- Set up your data. Put the text you want to search in column A, starting at A2. Leave row 1 for headers.
- Write the basic contains formula. In B2, type
=ISNUMBER(SEARCH("apple", A2)). Press Enter. The result is TRUE if A2 contains "apple" anywhere (including "pineapple" or "Apple Inc."), and FALSE otherwise. SEARCH is not case-sensitive. - Fill down. Select B2, grab the fill handle (the small square at the bottom-right corner), and drag down to the last row of your data. Each row now shows TRUE or FALSE.
- Make it case-sensitive if needed. Replace SEARCH with FIND:
=ISNUMBER(FIND("Apple", A2)). FIND distinguishes uppercase from lowercase, so "apple" will not match "Apple". - Return a friendly label instead of TRUE/FALSE. Wrap the formula in IF:
=IF(ISNUMBER(SEARCH("apple", A2)), "Contains apple", "No match"). This is easier to read in reports. - Search for a value stored in another cell. Put the search term in D1 (for example, "apple") and reference it:
=ISNUMBER(SEARCH($D$1, A2)). The dollar signs lock the reference so it does not shift when you fill down. - Filter by the result. Select your header row, go to Data > Filter, click the filter arrow on the helper column, and choose TRUE. Only matching rows remain visible. Clear the filter to restore all rows.
- Highlight matches with conditional formatting. Select the data range (for example, A2:A100), go to Home > Conditional Formatting > New Rule > Use a formula to determine which cells to format, and enter
=ISNUMBER(SEARCH("apple", A2)). Choose a fill color and click OK. The formula is relative to the top-left cell of the selection, so A2 is correct if your range starts at A2. - Count matches. Use
=SUMPRODUCT(--ISNUMBER(SEARCH("apple", A2:A100)))to count how many cells contain the substring. SUMPRODUCT handles the array without needing Ctrl+Shift+Enter in older versions. - Check for multiple substrings. To test whether a cell contains any of several terms, nest SEARCH calls with OR:
=IF(OR(ISNUMBER(SEARCH("apple",A2)), ISNUMBER(SEARCH("pear",A2))), "Match", "No match"). For many terms, a helper column per term is easier to audit.
Menu labels can differ slightly by Excel version, device, and region. The steps above apply to Excel for Windows and Mac desktop; Excel for the web has the same functions but the conditional formatting dialog is arranged differently.
Common Mistakes
- Using SEARCH without ISNUMBER. SEARCH alone returns a number (the position) or #VALUE! when not found. Wrapping it in ISNUMBER converts both outcomes to TRUE or FALSE, which is what filters and conditional formatting expect.
- Forgetting wildcards. SEARCH treats ? and * as wildcards. To search for a literal question mark or asterisk, put a tilde in front:
~?or~*. FIND does not use wildcards at all. - Mixing up FIND and SEARCH. FIND is case-sensitive; SEARCH is not. Choose deliberately, because "apple" and "Apple" behave differently.
- Relative references that shift. When you copy a formula that references a search-term cell, lock it with $ (for example, $D$1), or the reference will move and return wrong results.
- Applying conditional formatting to the wrong range. The formula must be written relative to the active cell at the top-left of the selected range. If your range starts at A2 but the formula references A1, the highlighting will be off by one row.
- Searching numbers as text. If the cell contains a number, SEARCH converts it to text, but leading zeros or formatted numbers may not match as expected. Use TEXT to standardize first if needed.
Tips
- Use a named range for the search term (Formulas > Define Name) to make formulas easier to read and update.
- For a quick visual check without formulas, use Find and Replace (Ctrl+F) to locate a substring, but this does not create a reusable result.
- Combine with TRIM to avoid false negatives caused by extra spaces:
=ISNUMBER(SEARCH("apple", TRIM(A2))). - If you need to extract the substring rather than just test for it, use MID, LEFT, or RIGHT with SEARCH to find the position.
- Keep helper columns in a separate area or hidden column so the sheet stays readable.
Troubleshooting
If the formula returns #VALUE!, the most likely cause is that SEARCH or FIND is used without ISNUMBER, or the cell reference is invalid. Check that the referenced cell contains text and that the formula syntax is correct.
If everything returns FALSE when you expect TRUE, check case sensitivity (you may need SEARCH instead of FIND), confirm there are no leading or trailing spaces in the cell, and verify that the search term is spelled exactly as it appears in the data. Also check whether wildcards are being interpreted: a search for "a*b" will match "axxb" because * is a wildcard; escape it with a tilde if you need a literal asterisk.
If conditional formatting highlights the wrong cells, re-check the range and the formula's relative reference. The formula should refer to the top-left cell of the selected range without dollar signs on the row/column you want to move.
If filtering shows no TRUE values, make sure the helper column was filled down to all rows and that the filter is applied to the correct column. Also confirm the formula results are actual TRUE/FALSE values, not text strings "TRUE" or "FALSE".
If the formula is slow on a very large dataset, consider using a helper column with the ISNUMBER(SEARCH(...)) result and then filtering or using SUMIFS on that column, rather than array formulas over entire columns.
Frequently Asked Questions
How do I check if a cell contains any text from a list?
Use nested SEARCH calls with OR, or a helper column per term. For a long list, a formula with SUMPRODUCT and SEARCH over the list range can work, but it is easier to maintain with one helper column per term.
Can I use wildcards with SEARCH?
Yes. SEARCH supports ? (any single character) and * (any sequence). To search for a literal ? or *, precede it with a tilde (~). FIND does not support wildcards.
Why does my formula return #VALUE!?
SEARCH returns #VALUE! when the substring is not found. Wrapping it in ISNUMBER converts that error to FALSE. If you still see #VALUE!, check that the cell reference is valid and that you have not mistyped the function name.
Is there a CONTAINS function in Excel?
No. Excel does not have a built-in CONTAINS function. The standard approach is ISNUMBER(SEARCH(...)) or ISNUMBER(FIND(...)).
How do I make the search case-sensitive?
Use FIND instead of SEARCH. FIND distinguishes uppercase and lowercase letters.
Can I search for text in multiple columns at once?
Yes, but you need to combine the columns first, for example with =ISNUMBER(SEARCH("apple", A2 & " " & B2)). This concatenates the two cells with a space so the search covers both.