Excel String Contains: How to Check If a Cell Contains Text
In this article
Yes, Excel can check whether a cell contains a specific piece of text, even though there is no single function literally named "contains." The standard way is to combine ISNUMBER with SEARCH (case-insensitive) or FIND (case-sensitive). For example, =ISNUMBER(SEARCH("apple", A1)) returns TRUE if cell A1 contains "apple" anywhere in it, and FALSE if it does not. You can wrap that in IF to return custom results, or use COUNTIF with wildcards when you want a simpler check. This guide walks through each method step by step.
What You'll Need
- Excel for Windows or Mac (any recent version), Excel for the web, or a compatible spreadsheet app that supports these functions
- A worksheet with some text data to test against
- Basic familiarity with typing formulas into cells
Exact menu labels can differ slightly between Excel versions and platforms, but the formulas below work identically in all of them.
Step-by-Step
- Open your workbook and click the cell where you want the result to appear.
- Enter the basic contains formula. Type
=ISNUMBER(SEARCH("text", A2))and press Enter, replacing "text" with the word or phrase you are looking for and A2 with your target cell. SEARCH returns the character position of the match; ISNUMBER converts that into a clean TRUE or FALSE (SEARCH returns an error when nothing is found, and ISNUMBER turns that error... actually it returns FALSE only when paired correctly, so see the IFERROR note in the Tips section). - Use FIND instead of SEARCH for a case-sensitive check.
=ISNUMBER(FIND("Apple", A2))matches "Apple" but not "apple". SEARCH ignores case; FIND respects it. - Return custom text instead of TRUE/FALSE. Wrap the check in IF:
=IF(ISNUMBER(SEARCH("apple", A2)), "Yes", "No"). Replace "Yes" and "No" with whatever labels suit your data. - Handle errors cleanly. Because SEARCH and FIND return
#VALUE!when the text is absent, a more robust version is=IFERROR(IF(SEARCH("apple", A2), "Yes"), "No"). IFERROR catches the no-match error and returns your fallback value. - Copy the formula down. Click the cell with the formula, then drag the small square fill handle at the bottom-right corner down alongside your data, or double-click the fill handle to fill down automatically.
- Alternative: use COUNTIF with wildcards. For a case-insensitive check that also ignores errors by design, use
=IF(COUNTIF(A2, "*apple*")>0, "Yes", "No"). The asterisks are wildcards meaning "any characters before or after." This works when checking a single cell or a whole range at once:=COUNTIF(A2:A100, "*apple*")counts every cell containing the word. - Check for multiple words at once. Combine checks with OR:
=IF(OR(ISNUMBER(SEARCH("apple", A2)), ISNUMBER(SEARCH("pear", A2))), "Found", "Not found"). - Filter instead of using formulas (optional). Select your data, press Ctrl+Shift+L to add filter arrows, click the arrow on the column, choose Text Filters > Contains, and type your word. This hides non-matching rows rather than adding a results column.
Common Mistakes
- Forgetting quotes around the search text.
SEARCH(apple, A2)fails because Excel treats apple as a named range; it must beSEARCH("apple", A2). - Swapping the arguments. The order is
SEARCH(find_text, within_text)— the word you want comes first, the cell to look in comes second. Reversed arguments silently check the wrong thing. - Expecting SEARCH to return FALSE. It returns a position number or an error, never FALSE, which is why you pair it with ISNUMBER or wrap it in IFERROR.
- Ignoring case differences. Using SEARCH when you needed FIND (or vice versa) gives results that look wrong but are not — double-check which behavior you actually want.
- Not anchoring references. If you put the search word in its own cell (good practice), lock it with dollar signs —
SEARCH($E$1, A2)— before filling down, or the reference shifts. - Wildcards inside SEARCH. SEARCH itself supports wildcards, but
"*apple*"inside SEARCH is unnecessary and behaves differently than in COUNTIF. Save the asterisks for COUNTIF.
Tips
- Put the search word in its own cell and reference it absolutely, so you can change the lookup term once instead of editing every formula.
- Use
SEARCHby default — most everyday checks should not care about capitalization. - For large datasets, COUNTIF over a whole range is faster than a formula in every row when you only need a total count.
- Combine with conditional formatting: select the column, choose Home > Conditional Formatting > New Rule > Use a formula, and enter
=ISNUMBER(SEARCH("apple", A2))to highlight matching rows visually. - If you have Excel 365 or Excel 2021, the newer
XLOOKUPand dynamic array functions can also search text with wildcards, but ISNUMBER+SEARCH remains the simplest for a plain yes/no check.
Troubleshooting
- Formula returns #VALUE! everywhere: the text was not found and you did not wrap SEARCH in ISNUMBER or IFERROR. Add one of them.
- Formula returns FALSE when it should match: check for extra spaces in your data. Wrap the cell in TRIM —
SEARCH("apple", TRIM(A2))— or clean the column with Data > Text to Columns or Find & Replace. - Matches the wrong rows: SEARCH matches substrings, so "cat" also matches "category." To match whole words only, add spaces to the pattern:
SEARCH(" cat ", " " & TRIM(A2) & " "). - Nothing updates after editing data: check that calculation is on via Formulas > Calculation Options > Automatic, or press F9 to recalculate.
- Formula shows as text instead of calculating: the cell is formatted as Text. Change it to General (Home > Number Format), then re-enter the formula.
Frequently Asked Questions
Is there a CONTAINS function in Excel?
No. Excel has no built-in CONTAINS function. The standard approach is ISNUMBER(SEARCH(...)), or COUNTIF with wildcards.
What is the difference between SEARCH and FIND?
SEARCH is case-insensitive and supports wildcards; FIND is case-sensitive and does not support wildcards. Both return the starting position of the matched text or an error.
How do I check if a cell contains one of several words?
Chain checks with OR, for example =OR(ISNUMBER(SEARCH("a",A2)), ISNUMBER(SEARCH("b",A2))). In Excel 365 you can also search a list of terms with a dynamic array formula.
How do I highlight cells that contain a certain word?
Use conditional formatting with the formula =ISNUMBER(SEARCH("word", A2)) applied to your range, or use Text Filters > Contains to filter them.
Does this work in Google Sheets too?
Yes. SEARCH, FIND, ISNUMBER, IFERROR and COUNTIF behave the same way in Google Sheets, so these formulas transfer directly.
Can I ignore case with COUNTIF?
COUNTIF is already case-insensitive, so =COUNTIF(A2, "*APPLE*") and "*apple*" return the same result.