How to use the ISTEXT function
What is the ISTEXT function?
The ISTEXT function returns Boolean value TRUE if value is text. Use the ISTEXT function in a formula to identify text values for example in an IF function.
Table of contents
1. What is text in Excel?
Excel tries to identify inserted values automatically, text values are left-aligned. Boolean values and error values are centered in cells, and numerical values are right-aligned. You can change the alignment if you like.
Cells containing text values evaluates to TRUE by the ISTEXT function. The ISNTEXT function lets you check a value programmatically in a formula instead of visually identify values by their position in a cell.
What is a formula?
A formula in Excel is an expression that calculates a value based on the values in other cells. Formulas must start with an equals sign "=" and can contain cell references, math operators, functions, constants, arrays, etc. They are used to perform calculations in Excel.
What is a Boolean value?
A Boolean value in Excel is a value that can only be TRUE or FALSE. It represents binary logic and is the result of a logical expression using logical operators or a result of a few Excel functions that I'll discuss below.
Mastering Boolean logic and logical expressions is key to manipulating data and controlling workflow in Excel.
Other IS functions
Excel Function | Description |
---|---|
ISBLANK(value) | Returns TRUE if the value is empty, FALSE otherwise |
ISERR(value) | Returns TRUE if the value is any error value except #N/A, FALSE otherwise |
ISERROR(value) | Returns TRUE if the value is any error value, FALSE otherwise |
ISEVEN(value) | Returns TRUE if the value is an even number, FALSE for odd numbers |
ISFORMULA(reference) | Returns TRUE if the cell contains a formula, FALSE otherwise |
ISLOGICAL(value) | Returns TRUE if the value is a logical value (TRUE/FALSE), FALSE otherwise |
ISNA(value) | Returns TRUE if the value is the #N/A error, FALSE otherwise |
ISNONTEXT(value) | Returns TRUE if the value is not text, FALSE if it is text |
ISNUMBER(value) | Returns TRUE if the value is a number, FALSE otherwise |
ISODD(value) | Returns TRUE if the value is an odd number, FALSE for even numbers |
2. ISTEXT function Syntax
ISTEXT(value)
3. ISTEXT function Arguments
value | Required. The value you want to check for text. |
4. ISTEXT function example
Formula in cell C3:
The ISTEXT function is very useful to identify error values in arrays. Most Excel functions return the error value, however, this function returns FALSE if it encounters an error.
5. Filter text values
This example demonstrates how to filter text values from a cell range excluding numbers, errors, and Boolean values.
Excel 365 dynamic array formula in cell C3:
The FILTER function lets you extract specific values based on Boolean values, a value is included if the corresponding value is TRUE and excluded if the corresponding value is FALSE.
5.1 Explaining formula
Step 1 - Identify text values
ISTEXT(B3:B9)
becomes
ISTEXT({"A";1;#DIV/0!;"B";TRUE;2;"V"})
and returns
{TRUE;FALSE;FALSE;TRUE;FALSE;FALSE;TRUE}
Step 2 - Filter values
The FILTER function extracts values/rows based on a condition or criteria.
Function syntax: FILTER(array, include, [if_empty])
FILTER(B3:B9,ISTEXT(B3:B9))
becomes
FILTER({"A";1;#DIV/0!;"B";TRUE;2;"V"}, {TRUE;FALSE;FALSE;TRUE;FALSE;FALSE;TRUE})
and returns
{"A";"B";"V"}
6. If cell contains any text
The picture above shows different values in column B and a formula in column C that tries to identifies the value in column B.
Formula in cell C3:
The formula above checks if a cell contains a text value based on whether Excel correctly identified and formatted the cell as a text value or not.
This works often quite well, however, sometimes numbers are formatted as text.
This can happen if you import data from a database, copy and paste values from the web or a formula that returns numbers that Excel handles as a text string, among other things.
For example, cell B10 has a number formatted as a text value and the ISTEXT function incorrectly identifies the number as a text value.
The following formula will correctly identify numbers even if Excel identifies the number as a text value.
Formula in cell C3:
6.1 Explaining formula in cell C10
The formula in cell C10 is
B10*1 returns a number if B10 contains a number and an error for anything else.
13*1 = 13
ISNUMBER(B10*1) returns TRUE if the argument is a number and FALSE for all else.
ISNUMBER(B10*1) returns TRUE.
The NOT function returns TRUE if FALSE and FALSE if TRUE.
NOT(ISNUMBER(B10*1))
becomes
NOT(TRUE) and returns FALSE.
The ISTEXT function returns TRUE for all text values.
ISTEXT(B10) returns TRUE.
Multiplying the two functions is the same as AND logic. I could use the AND function, however, the * (asterisk) is smaller.
ISTEXT(B10)*NOT(ISNUMBER(B10*1))
becomes
TRUE*FALSE and returns 0. 1*0 = 0
The IF function then returns the third argument.
IF(ISTEXT(B10)*NOT(ISNUMBER(B10*1)),"Text","Not text")
becomes
IF(0,"Text","Not text")
and returns "Not text" in cell C10.
Get Excel *.xlsx file
If cell contains any text.xlsx
'ISTEXT' function examples
This article demonstrates how to set up a chart so it shows one color for increasing bars/columns and another color […]
Table of Contents Count cells with text Count cells with text excluding cells containing a space character Count text values […]
This article demonstrates ways to extract unique distinct sorted from A to Z ignoring blanks, and based on a condition. […]
Functions in 'Information' category
The ISTEXT function function is one of 19 functions in the 'Information' category.
How to comment
How to add a formula to your comment
<code>Insert your formula here.</code>
Convert less than and larger than signs
Use html character entities instead of less than and larger than signs.
< becomes < and > becomes >
How to add VBA code to your comment
[vb 1="vbnet" language=","]
Put your VBA code here.
[/vb]
How to add a picture to your comment:
Upload picture to postimage.org or imgur
Paste image link to your comment.
Contact Oscar
You can contact me through this contact form