If Excel Cell Contains Text: Useful Formulas and Examples

Formulas & functions · Updated November 2, 2026

If Excel Cell Contains Text: Useful Formulas and Examples

With the text to check in A2, use =IF(ISNUMBER(SEARCH("apple",A2)),"Yes","No") to test whether the cell contains “apple” anywhere; the result is Yes when it does and No when it does not. If you mean “does this cell contain a text value at all?” rather than “does it contain a particular phrase?”, use Excel’s ISTEXT function instead.

These are different questions, and choosing the right test matters. A cell can hold text without containing the word you are searching for, and a cell that looks like text may actually contain a number. The examples below explain how to choose a formula, adapt it to a range, and avoid common surprises.

What “contains text” can mean in Excel

People usually mean one of three things when they ask whether an Excel cell contains text:

  • Contains a particular word or phrase: Look for a substring anywhere in the cell, such as “apple” in “Green apple juice.” SEARCH is commonly used for this.
  • Is a text value: Check the cell’s data type, regardless of its contents. ISTEXT does this.
  • Contains any nonblank text: Check that the cell has text and that the text is not empty or just spaces. This needs a slightly stricter test.

These checks are not interchangeable. For example, the number 42 is not a text value, even though Excel can display it beside words. Conversely, a cell containing “42” stored as text is a text value. A formula that searches for a word answers a content question; it does not reliably answer a data-type question.

Find a word or phrase anywhere in a cell

With descriptions in A2:A20 and the word to find being “apple,” use the formula below in B2 and fill it down. For A2 containing “Green apple juice,” the result is Yes; for A2 containing “Orange juice,” it is No.

=IF(ISNUMBER(SEARCH("apple",A2)),"Yes","No")

SEARCH returns the position where the requested text begins. If it finds the word, that position is a number, so ISNUMBER returns TRUE and IF displays Yes. If SEARCH cannot find it, it returns an error; ISNUMBER makes the test return FALSE, allowing IF to display No. SEARCH is not case-sensitive, so “Apple,” “APPLE,” and “apple” all match.

To return TRUE or FALSE instead of labels, with the same descriptions in A2:A20, use this in B2 and fill down. It returns TRUE for “Green apple juice” and FALSE for “Orange juice.”

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

This TRUE/FALSE version is useful in filters, other formulas, or helper columns. Use the IF version when a readable label is more useful to the person reviewing the sheet.

Check whether a cell contains any text

With a value to test in A2, use the following formula to label text values. If A2 contains the text “North,” it returns Text; if A2 contains the number 42, it returns Not text.

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

ISTEXT checks the value type rather than whether the cell looks empty or contains a particular word. It returns TRUE for text and FALSE for numbers, dates stored as Excel serial numbers, and blank cells. A formula that returns an empty string, however, produces text, so ISTEXT can return TRUE for a cell that appears blank. That distinction often matters in worksheets built from formulas.

If you want to exclude empty strings and cells containing only ordinary spaces, with a possible text value in A2, use this formula. It returns Has text for “North” and No text for a genuinely blank cell, an empty string, or a value made only of spaces.

=AND(ISTEXT(A2),LEN(TRIM(A2))>0)

TRIM removes leading and trailing ordinary spaces and reduces repeated spaces between words. It does not remove every kind of invisible character; for example, data copied from a web page may contain nonbreaking spaces. If the formula says a cell contains text even though it looks empty, inspect the source data or clean the imported characters rather than assuming the cell is truly blank.

Choose between SEARCH, FIND, and an exact match

SEARCH is a good default for locating a phrase because it ignores letter case. If the match must respect uppercase and lowercase letters, use FIND instead. With descriptions in A2:A20, this formula in B2 returns Match for “ABC-17” but No match for “abc-17.”

=IF(ISNUMBER(FIND("ABC",A2)),"Match","No match")

FIND and SEARCH both look for text within other text, but FIND is case-sensitive. Neither function means “match the whole cell exactly”; both can find the requested characters as part of a longer value.

For a whole-cell comparison, with a value in A2, use the formula below. It returns Match for “apple” and No match for “green apple.”

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

The equals comparison is not case-sensitive in a standard Excel formula, so “APPLE” also matches. It can be affected by leading or trailing spaces: “apple ” is not the same value as “apple.” If you need a case-sensitive whole-cell comparison, use EXACT; with the candidate value in A2, this returns TRUE only when A2 exactly matches “Apple,” including its capitalization.

=EXACT(A2,"Apple")

Count cells that contain a phrase

If you need a total rather than a result beside every row, COUNTIF can count cells containing a substring. With descriptions in A2:A20, the formula below returns 2 if the range contains “Green apple juice” and “Apple pie,” but not “Orange juice.”

=COUNTIF(A2:A20,"*apple*")

The asterisks are wildcards: each one can stand for any number of characters, including none. COUNTIF is not case-sensitive, so the formula also counts “APPLE.” This is convenient for quick summaries, while SEARCH is more flexible when each row needs a custom output or the lookup phrase is stored in another cell.

Question marks are also wildcard characters in criteria, representing one character. If you need to search for a literal asterisk or question mark, prefix that character with a tilde in the COUNTIF criterion. For instance, a criterion designed to look for a literal asterisk uses ~* between the surrounding wildcards, rather than treating the asterisk as “any characters.”

Return a result for each row or for several phrases

To process a list, put the formula in the first result row and copy it down. With descriptions in A2:A100, enter the SEARCH-and-IF formula in B2, then use the fill handle or copy and paste it into the remaining rows. The reference A2 adjusts to A3, A4, and so on, so each result checks the description beside it. Keep the search phrase in quotes when it is typed directly into the formula.

If the phrase should be editable, put it in D1 instead. With descriptions in A2:A100 and the search phrase in D1, use this formula in B2 and fill down. If D1 contains “apple,” a row containing “Green apple juice” returns Yes.

=IF(ISNUMBER(SEARCH($D$1,A2)),"Yes","No")

The dollar signs keep the phrase reference fixed at D1 while the description reference changes by row. This makes the formula easier to maintain when the search term changes. If D1 is blank, SEARCH finds an empty phrase at the start of the text, so the formula can mark every row as a match. Check that the search cell is populated when an empty search should not count.

For two possible phrases, with descriptions in A2:A20, this formula in B2 returns Review if A2 contains “late” or “overdue,” and OK otherwise. It ignores case for both searches.

=IF(OR(ISNUMBER(SEARCH("late",A2)),ISNUMBER(SEARCH("overdue",A2))),"Review","OK")

For a long list of phrases, nesting many SEARCH tests becomes difficult to read and update. A small lookup list or a purpose-built formula may be easier to maintain than a very long OR expression.

Highlight cells that contain text

Conditional formatting can highlight matches without adding a helper column. To highlight cells in A2:A100 that contain “urgent,” select that range and choose Home > Conditional Formatting > New Rule. In the rule options, choose “Use a formula to determine which cells to format,” enter the formula below, choose a format, and confirm the rule. The formula highlights A2 when it contains “urgent,” regardless of case; the rule adjusts for each selected row.

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

To color an entire row based on the text in column A, select the full data area, such as A2:D100, before creating the rule and use this formula instead. The dollar sign fixes the check to column A while the row number remains relative, so each row is formatted according to its own description.

=ISNUMBER(SEARCH("urgent",$A2))

Conditional formatting changes the appearance of cells, not their contents. It is useful for visual review, but a helper-column formula is usually better if the result must be filtered, counted, exported, or used in another calculation.

Common problems and how to resolve them

  • The result says No even though the cell looks like a match: Check for spelling differences, punctuation, or hidden characters. A nonbreaking space or other imported character can make text differ from what it appears to be.
  • A blank-looking cell matches: It may contain a formula returning an empty string, spaces, or invisible characters. ISTEXT can treat a formula-produced empty string as text. Use the nonblank test where appropriate and inspect the cell’s formula or source.
  • A number is not recognized as text: That is expected with ISTEXT. A value such as 42 may be numeric, while the characters “42” can be stored as text. If you need to find digits within either kind of value, test representative data and decide whether converting the values is appropriate.
  • The formula displays as text instead of calculating: Check that the cell is not formatted as Text and that the formula begins with an equals sign. If it was entered while the cell was formatted as Text, change the format to General and re-enter the formula.
  • Unexpected case behavior: SEARCH and COUNTIF are case-insensitive. Use FIND for a case-sensitive substring search, or EXACT for a case-sensitive whole-cell comparison.
  • A wildcard matches more than expected: In COUNTIF criteria, * and ? have special meanings. Escape a character that must be treated literally with a tilde, or use SEARCH/FIND when wildcard matching is not wanted.

Excel’s formula argument separator can depend on regional settings. The formulas here use commas, as specified for the usual Microsoft 365 Windows setup; if Excel rejects a formula on a device configured for a different list separator, the local setting may require semicolons instead.

Frequently Asked Questions

How do I check if a cell contains specific text in Excel?
Use ISNUMBER with SEARCH to test for a phrase anywhere in the cell. Wrap the test in IF if you want labels such as Yes and No. SEARCH does not distinguish uppercase from lowercase.

How do I check if a cell contains any text, not a particular word?
Use ISTEXT on the cell. If you also want to exclude empty strings and ordinary spaces, combine ISTEXT with LEN and TRIM. Remember that ISTEXT can return TRUE for a formula whose displayed result is an empty string.

What is the difference between SEARCH and FIND in Excel?
Both locate text within a cell. SEARCH is case-insensitive, while FIND is case-sensitive. Use an exact comparison or EXACT when the whole cell, rather than a substring, must match.

How can I count cells that contain a word?
Use COUNTIF with asterisks around the word as a wildcard criterion. For example, a criterion shaped like *apple* counts cells with “apple” anywhere in the value and ignores letter case.

Can Excel highlight a cell if it contains certain text?
Yes. Create a conditional-formatting rule using a formula based on ISNUMBER and SEARCH. Select the cells or rows to format first, then set the reference so it checks the intended column for every row.

Related

Try it: the Formula Explainer: paste any formula and see each function and reference in plain English.

More in Formulas & functions

Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources

Spotted an error in this guide? Let us know.