To check whether an Excel cell contains particular text, combine IF with a text-search function such as SEARCH or FIND.

The examples below show how to return custom results, handle case sensitivity, and avoid errors when the text is missing.

Check whether a cell contains specific text

Suppose cells A2:A5 contain product descriptions, and you want to label any description containing “apple.” In B2, enter:

=IF(ISNUMBER(SEARCH("apple",A2)),"Match","No match")

Fill the formula down through B5.

SEARCH looks for the text “apple” anywhere in A2.

If it finds the text, it returns the starting position as a number.

ISNUMBER converts that result into TRUE; if the text is absent, SEARCH returns an error and ISNUMBER returns FALSE.

IF then displays the appropriate label.

For example, if A2 contains “Green apple juice,” the result is “Match.” If it contains “Orange juice,” the result is “No match.” Change the two result strings to any text, number, or formula result that suits your worksheet.

Use wildcards with IF and COUNTIF

For a straightforward contains check, COUNTIF is another option:

=IF(COUNTIF(A2,"*apple*"),"Match","No match")

The asterisks mean that any characters may appear before or after “apple.” The formula returns “Match” when the cell contains that text.

COUNTIF is not case-sensitive, and the criterion is text matching rather than a literal search: * and ? are wildcard characters.

If you need to search for a literal asterisk or question mark, prefix it with a tilde in the criterion, such as "*~**" to look for an asterisk anywhere in a cell.

Choose between SEARCH and FIND

Use SEARCH when uppercase and lowercase letters should count as the same.

For example, it finds “apple” in “Apple pie.” Use FIND when capitalization must match exactly:

=IF(ISNUMBER(FIND("Apple",A2)),"Exact-case match","No match")

This formula matches “Apple pie,” but not “apple pie.” Both functions search inside the cell and return a number indicating where the match starts.

Both return an error if they cannot find the requested text, which is why the example wraps the search in ISNUMBER.

Return TRUE or FALSE instead of a label

If another formula will use the result, you may not need IF.

This expression returns TRUE when A2 contains “apple” and FALSE otherwise:

=ISNUMBER(SEARCH("apple",A2))

Use it in a conditional formatting rule, a filter helper column, or another logical test.

For instance, if you want to sum values in B2:B100 only when the matching description in A2:A100 contains “apple,” use SUMIF with a wildcard criterion:

=SUMIF(A2:A100,"*apple*",B2:B100)

Check for one of several text strings

To return “Fruit” when A2 contains either “apple” or “pear,” add the two search tests with OR:

=IF(OR(ISNUMBER(SEARCH("apple",A2)),ISNUMBER(SEARCH("pear",A2))),"Fruit","Other")

For more search terms, the formula grows as you add tests.

In Microsoft 365 or Excel 2021, an array formula can be more compact:

=IF(SUM(--ISNUMBER(SEARCH({"apple","pear","plum"},A2)))>0,"Fruit","Other")

The double unary operator converts the TRUE and FALSE search results to 1s and 0s, and SUM checks whether at least one term matched.

The > comparison is written as text inside the code element, not as an HTML tag.

Handle blank cells and missing text

A blank cell usually produces “No match” in the basic SEARCH formula.

If blank cells should remain blank, test for an empty cell first:

=IF(A2="","",IF(ISNUMBER(SEARCH("apple",A2)),"Match","No match"))

If the cell might contain an error value, the search can return that error before ISNUMBER evaluates it.

Use IFERROR to specify a fallback:

=IFERROR(IF(ISNUMBER(SEARCH("apple",A2)),"Match","No match"),"Check source cell")

This displays “Check source cell” if evaluating the formula encounters an error.

Use IFERROR deliberately: it also catches errors unrelated to whether the search term exists, which can otherwise hide a problem in the source data.

Check whether a cell contains any text

If you mean “does this cell contain text at all?” rather than “does it contain this particular word?”, use ISTEXT:

=IF(ISTEXT(A2),"Text value","Not text")

ISTEXT returns TRUE for text, including text that looks like a number, such as "123".

It returns FALSE for a numeric value, a blank cell, or a date stored as an Excel serial number.

A formula that returns an empty string may behave differently from a truly empty cell, so account for formulas in the range if that distinction matters.

Compatibility with Excel and Google Sheets

IF, ISNUMBER, SEARCH, FIND, COUNTIF, OR, and IFERROR are available in current desktop and web versions of Microsoft Excel and in Google Sheets.

The basic formulas work in older Excel versions as well.

The array-constant example is intended for dynamic-array versions such as Microsoft 365 and Excel 2021; older Excel releases may require array entry or a different construction.

Google Sheets supports array calculations but may use different regional separators depending on spreadsheet locale.

If your formulas use semicolons between arguments, replace commas with semicolons to match your regional settings.

Also check whether imported values contain leading or trailing spaces: a search still finds text inside a cell, but extra spaces can affect exact comparisons and other cleanup formulas.

Common formula mistakes

  • Using SEARCH by itself in IF: A missing term produces an error.

    Wrap the search in ISNUMBER or use IFERROR.
  • Expecting case sensitivity from SEARCH: It ignores case.

    Switch to FIND when capitalization matters.
  • Checking for a whole-cell match: A test such as =A2="apple" checks equality, not whether “apple” appears within a longer description.
  • Using the wrong reference when filling down: Use A2 for a reference that should move to A3, A4, and so on.

    Add dollar signs, as in $A$2, only when the reference should remain fixed.