Excel Formula Has Text? How to Check & Use It

Formulas & functions · Updated November 22, 2026

Yes, an Excel formula can return text, and you can check whether a cell contains text using the ISTEXT function. For example, =ISTEXT(A1) returns TRUE if cell A1 contains text (including formula results that are text) and FALSE otherwise. This is the fastest way to test for text in a cell, but there are several other functions and techniques you can use depending on what you need to do with that text.

How to Check if a Cell Contains Text

The simplest method is the ISTEXT function. It works on any cell reference or formula result. For instance, with the value “Hello” in A1, =ISTEXT(A1) returns TRUE. If A1 contains the number 123, it returns FALSE. Note that ISTEXT returns FALSE for empty cells and for cells containing errors, dates, or numbers, even if those numbers are formatted as text.

If you need to check whether a cell contains any text characters (like letters) within a longer string, use ISNUMBER combined with SEARCH or FIND. For example, to check if cell A2 contains the word “urgent”, use:

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

This returns TRUE if “urgent” appears anywhere in A2 (case-insensitive). FIND is case-sensitive, so =ISNUMBER(FIND("urgent", A2)) would only match lowercase “urgent”.

How to Count Cells That Contain Text

To count how many cells in a range contain text, use COUNTIF with a wildcard. The formula =COUNTIF(A1:A10,"*") counts all cells that contain any text, including numbers stored as text. It does not count empty cells or cells with numbers, dates, or errors. If you want to count cells that contain specific text, use =COUNTIF(A1:A10,"*urgent*") to count cells that contain the word “urgent” anywhere.

For more complex counting, you can use SUMPRODUCT with ISTEXT: =SUMPRODUCT(--ISTEXT(A1:A10)). This works in all Excel versions and counts every cell in the range that contains text.

How to Extract or Manipulate Text from a Cell

Once you know a cell contains text, you often want to extract parts of it. The core text functions are:

  • LEFT(text, num_chars) – returns the first num_chars characters from the left.
  • RIGHT(text, num_chars) – returns the last num_chars characters.
  • MID(text, start_num, num_chars) – returns characters from the middle, starting at start_num.
  • LEN(text) – returns the number of characters in the text.
  • CONCATENATE or & – joins text from multiple cells. For example, =A1 & " " & B1 combines the text in A1 and B1 with a space.

For example, if A1 contains “Invoice 2024”, =LEFT(A1,7) returns “Invoice”, and =RIGHT(A1,4) returns “2024”. =MID(A1,9,4) returns “2024” as well (starting at character 9).

How to Convert Text to Numbers or Dates

Sometimes a cell looks like a number but is actually text, which breaks calculations. The VALUE function converts text that looks like a number to a number: =VALUE("123") returns 123. For dates, DATEVALUE converts a date text string to a serial date: =DATEVALUE("1/1/2024") returns 45292 (the serial number for that date).

You can also use the NUMBERVALUE function for more control, especially with different decimal separators. For example, =NUMBERVALUE("1.234,56",",",".") returns 1234.56, interpreting the comma as the decimal separator and the period as the thousands separator.

To convert an entire range of text numbers to real numbers, select the range, go to the Data tab, and click Text to Columns. In the wizard, choose “Delimited”, click Next, uncheck all delimiters, click Next, and choose “General” as the column data format. This is often faster than formulas.

Common Problems with Text in Formulas

One of the most frequent issues is the #VALUE! error. This occurs when a formula expects a number but receives text. For example, =A1+B1 returns #VALUE! if A1 contains the text “5” (as text). To fix this, convert the text to a number using VALUE or multiply by 1: =VALUE(A1)+B1 or =(A1*1)+B1.

Another common problem is trailing spaces. A cell may look like “Hello” but actually contain “Hello ” with a space at the end. This can break MATCH or VLOOKUP comparisons. Use the TRIM function to remove extra spaces: =TRIM(A1). For invisible non-breaking spaces (character 160), use =SUBSTITUTE(A1,CHAR(160),"").

Also, be aware of text alignment. By default, text is left-aligned and numbers are right-aligned. If a number looks left-aligned, it might be stored as text. You can check by selecting the cell and looking at the Number Format box on the Home tab.

Comparing Text with Formulas

When comparing text, Excel is case-insensitive by default. So =A1="hello" returns TRUE if A1 contains “Hello”. To make a case-sensitive comparison, use the EXACT function: =EXACT(A1,"hello") returns TRUE only if A1 is exactly “hello” in lowercase.

For wildcard comparisons, use COUNTIF or SUMIF with * (any sequence) and ? (single character). For example, =COUNTIF(A1:A10,"A*") counts cells starting with “A”. In formulas like VLOOKUP, wildcards are not supported in exact match mode, but you can use XLOOKUP with wildcards if you set the match mode to 2 (wildcard).

Frequently Asked Questions

How do I check if a cell contains any text (not numbers)?
Use =ISTEXT(A1). It returns TRUE for any text, including empty strings (“”) and text from formulas. It returns FALSE for numbers, dates, and errors.

Why does my formula return #VALUE! when the cell looks like a number?
This usually means the cell is formatted as text or contains a hidden character. Use =VALUE(A1) to convert it, or select the cell, click the warning icon, and choose “Convert to Number”.

Can I use wildcards in formulas to find text?
Yes, in COUNTIF, SUMIF, AVERAGEIF, and XLOOKUP (with match_mode 2). For example, =COUNTIF(A1:A10,"*cat*") counts cells containing “cat”. In VLOOKUP, wildcards work only if you use approximate match (TRUE).

How do I remove all text from a cell and keep only numbers?
There is no single built-in function, but you can use a formula with TEXTJOIN and MID to extract digits. For Excel 365, use: =TEXTJOIN("",TRUE,IF(ISNUMBER(--MID(A1,ROW(INDIRECT("1:"&LEN(A1))),1)),MID(A1,ROW(INDIRECT("1:"&LEN(A1))),1),"")) entered as an array formula (Ctrl+Shift+Enter in older versions). For a simpler approach, use the Power Query or a VBA macro.

Is there a difference between text and numbers in Excel?
Yes. Text is left-aligned and cannot be used in arithmetic operations directly. Numbers are right-aligned and can be summed, averaged, etc. Even if a number is formatted as text, it behaves as text in formulas.

How do I count cells that contain a specific word but not others?
Use COUNTIF with wildcards: =COUNTIF(A1:A10,"*apple*") counts cells containing “apple”. To exclude cells that also contain “pie”, use =COUNTIFS(A1:A10,"*apple*",A1:A10,"<>*pie*").

Alternatives and Advanced Tools

For complex text manipulation, consider using TEXTSPLIT (Excel 365) to split text by a delimiter. For example, =TEXTSPLIT(A1,",") splits the text in A1 into separate cells based on commas. TEXTBEFORE and TEXTAFTER extract text before or after a delimiter: =TEXTBEFORE(A1,"-") returns everything before the first hyphen.

If you need to clean up large datasets, Power Query (Get & Transform Data) is a robust alternative. You can split columns, remove non-printable characters, and change data types without writing formulas. To use it, select your data, go to Data > From Table/Range, and then use the transformations in the Power Query editor.

For advanced users, VBA macros can automate text extraction and replacement. For example, a simple macro to remove all non-numeric characters from a selected range:

Sub RemoveNonNumeric()
Dim cell As Range
Dim i As Integer
Dim result As String
' Save a copy of your workbook before running macros
For Each cell In Selection
result = ""
For i = 1 To Len(cell.Value)
If IsNumeric(Mid(cell.Value, i, 1)) Then
result = result & Mid(cell.Value, i, 1)
End If
Next i
cell.Value = result
Next cell
End Sub

Remember, macros cannot be undone with Ctrl+Z, so always save a backup first.

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.