The ISTEXT function returns TRUE if a value is text, and FALSE otherwise. It correctly identifies text values including empty strings, but returns FALSE for numbers, dates, times, errors, blank cells, Boolean values, and formulas that return non-text results. This function is essential for type checking before performing text operations.
Master the fundamentals of Excel ISTEXT function
The ISTEXT function is crucial for type checking and data validation in Excel. Understanding what ISTEXT considers "text" is important for building robust formulas that handle mixed data types. This function is particularly valuable when processing imported data, user input, or data from external sources where data types may be inconsistent.
ISTEXT returns TRUE for: any text string ("Hello", "123"), empty strings (""), text that looks like numbers ("123"), formulas that return text (TEXT functions, CONCATENATE results), and text values from functions or cell references. It returns FALSE for: actual numbers (123), dates and times (stored as numbers), errors (#N/A, #VALUE!, etc.), blank cells (ISBLANK returns TRUE, ISTEXT returns FALSE), Boolean values (TRUE/FALSE are numbers), and formulas that return numbers or errors.
A critical distinction: ISTEXT("") returns TRUE because empty strings are text, but ISTEXT(blank_cell) returns FALSE. ISBLANK returns TRUE for blank cells but FALSE for empty strings. This distinction is crucial when validating data: use ISBLANK for truly empty cells, use ISTEXT with ="" to check for empty text formulas.
ISTEXT distinguishes between text that looks like numbers ("123") and actual numbers (123). Text numbers return TRUE, actual numbers return FALSE. This is important when importing data where numbers may be stored as text. Use ISTEXT to identify these cases, then VALUE or NUMBERVALUE to convert them.
ISTEXT is essential for: validating text input in forms, ensuring data types before text operations (LEFT, RIGHT, MID, etc.), data cleaning to identify text values that need conversion, conditional text processing based on type, and type checking in complex formulas that handle mixed data.
ISTEXT is very efficient and works seamlessly with array formulas. Combine with IF for conditional logic, and with AND/OR for complex validation rules. When processing mixed data, use ISTEXT to branch logic: text values get text processing, numbers get numeric processing. This prevents errors and improves formula robustness.
Function-specific parameters
Function-specific return type
ISTEXT returns TRUE for: any text string ("Hello", "123"), empty strings (""), text that looks like numbers ("123"), formulas that return text (TEXT functions, CONCATENATE results), and text values from functions or cell references. It returns FALSE for: actual numbers (123), dates and times (stored as numbers), errors (#N/A, #VALUE!, etc.), blank cells (ISBLANK returns TRUE, ISTEXT returns FALSE), Boolean values (TRUE/FALSE are numbers), and formulas that return numbers or errors.
A critical distinction: ISTEXT("") returns TRUE because empty strings are text, but ISTEXT(blank_cell) returns FALSE. ISBLANK returns TRUE for blank cells but FALSE for empty strings. This distinction is crucial when validating data: use ISBLANK for truly empty cells, use ISTEXT with ="" to check for empty text formulas.
ISTEXT distinguishes between text that looks like numbers ("123") and actual numbers (123). Text numbers return TRUE, actual numbers return FALSE. This is important when importing data where numbers may be stored as text. Use ISTEXT to identify these cases, then VALUE or NUMBERVALUE to convert them.
ISTEXT is essential for: validating text input in forms, ensuring data types before text operations (LEFT, RIGHT, MID, etc.), data cleaning to identify text values that need conversion, conditional text processing based on type, and type checking in complex formulas that handle mixed data.
Exact matching required
Returns numeric position
Handles missing text gracefully
=ISTEXT(value)The value, cell reference, or expression to check. This can be any value type that Excel might contain.
TRUE if the value is text (including empty strings ""), FALSE if the value is a number, date, time, error, blank, Boolean, or any non-text type
Description: ISTEXT(value)
Basic ISTEXT check
The most common use case. Checks if cell A1 contains a text value. Returns TRUE for any text, including empty strings, and FALSE for numbers, dates, errors, or blank cells.
VBA implementation for ISTEXT.
Sub ISTEXTExample()
' Method 1: Using TypeName (most reliable)
Dim result As Boolean
result = TypeName(Range("A1").Value) = "String"
MsgBox "Is A1 text (TypeName): " & result
' Method 2: Using WorksheetFunction.IsText
Dim wsResult As Boolean
wsResult = Application.WorksheetFunction.IsText(Range("A1").Value)
MsgBox "Is A1 text (WorksheetFunction): " & wsResult
' Method 3: Using VarType
Dim cellValue As Variant
cellValue = Range("A1").Value
Dim varTypeResult As Boolean
varTypeResult = (VarType(cellValue) = vbString)
MsgBox "Is A1 text (VarType): " & varTypeResult
' Method 4: Comprehensive type checking
Dim inputValue As Variant
inputValue = Range("A1").Value
Select Case TypeName(inputValue)
Case "String"
MsgBox "Text value: " & inputValue
' Safe to perform text operations
Range("B1").Value = UCase(inputValue)
Case "Double", "Integer", "Long", "Single", "Currency"
MsgBox "Numeric value: " & inputValue
' Convert to text if needed
Range("B1").Value = CStr(inputValue)
Case "Boolean"
MsgBox "Boolean value: " & inputValue
Case "Date"
MsgBox "Date value: " & inputValue
Case "Empty"
MsgBox "Empty cell"
Case Else
MsgBox "Other type: " & TypeName(inputValue)
End Select
' Method 5: Check and process text values in range
Dim cell As Range
Dim textCount As Integer
textCount = 0
For Each cell In Range("A1:A10")
If TypeName(cell.Value) = "String" Then
textCount = textCount + 1
' Process text cell
cell.Offset(0, 1).Value = "Text: " & cell.Value
End If
Next cell
MsgBox "Found " & textCount & " text values in range A1:A10"
End SubData validation to ensure cells contain text values before text operations
Type checking to identify text data in mixed-type datasets
Conditional text processing based on data type
Data cleaning to identify and handle text values appropriately
Form validation requiring text input fields
Building robust formulas that safely handle mixed data types
Text manipulation workflows that need to verify text type first
Data import validation to check text columns
ISTEXT returns FALSE for values that look like text
Solution: The cell likely contains a number formatted as text, or a formula returning a number. Check the formula bar - if it shows a number without quotes, it's numeric. Use TEXT function to convert: =ISTEXT(TEXT(A1,"0")).
ISTEXT returns TRUE for empty cells when expecting FALSE
Solution: ISTEXT returns FALSE for truly blank cells. If you're seeing TRUE, the cell likely contains a formula returning an empty string (=""). Use ISBLANK to check for truly empty cells.
ISTEXT not working with imported text data
Solution: Imported data may contain hidden characters, non-breaking spaces, or formatting issues. Use TRIM and CLEAN: =ISTEXT(TRIM(CLEAN(A1))). Also verify the data actually contains text and not formatted numbers.
ISTEXT returns different results for similar values
Solution: Cells may contain invisible characters, formatting, or be the result of different formulas. Use TRIM, CLEAN, and LEN to inspect values. Check formulas in cells to see what they actually return.
ISTEXT with formulas showing unexpected results
Solution: ISTEXT checks the formula's result, not the formula itself. If a formula like =123 returns a number, ISTEXT will return FALSE even if displayed as text. Verify what the formula actually returns, not its displayed format.