Exceljet

Quick, clean, and to the point

Text value

Text values in Excel

A text value (also called a "text string") is one of Excel's primary content types. Other types of content include numbers, dates, times, and Boolean values. 

As data is entered into a worksheet, Excel makes a "best guess" on the type of content it is, and formats the value automatically. By default, text values are aligned on the left, and numeric values (including dates and times) are aligned on the right. This alignment quickly shows which values Excel considers text.

Text values in formulas

In a formula, text values require special treatment, and must be enclosed in double quotes (""). For example, the formula below uses the IF function to test a value in A1:

=IF(A1>70,"Pass", "Fail")

If A1 is greater than 70, the result is "Pass". If the value in A1 is less or equal to 70, the result is "Fail". Notice both "Pass" and "Fail" are surrounded with double quotes. This tells Excel to treat these values as text. The double quotes will not be visible in the final result.

ISTEXT function

To test if a value is text, you can use the ISTEXT function. In the formula below, ISTEXT will return TRUE if A1 contains text and FALSE if not:

=ISTEXT(A1)

Empty strings

Programmers refer to text values as "text strings". A special kind of text value an "empty string", which means a text value with no text. Empty strings will appear as empty double quotes ("").  You'll see empty strings appear in formulas like this:

=IF(A1="","",A1)

Translation: if A1 is empty, return an empty string, otherwise return A1.

Empty strings don't display anything in Excel. The formula above, when A1 is empty, will return a result that looks like an empty cell.

Enter number as text

To enter a number as text directly in a worksheet (i.e. not in a formula), precede the number with a single quote character ('). The resulting value will be text, but it will still look like a number. The single quote will not be visible.