Microsoft Office Tutorials and References
In Depth Information
Chapter 5: Manipulating Text
Numbers as text
As I mentioned, Excel distinguishes between numbers and text. If you want to “force” a number
to be considered as text, you can do one of the following:
h Apply the Text number format to the cell. Select Text from the Number Format
dropdown list, which can be found at Home
Number. If you haven’t applied other horizontal
alignment formatting, the value will appear left-aligned in the cell (like normal text), and
functions like SUM will not treat it as a value. Note, however, that it doesn’t work in the
opposite direction. If you enter a number and then format it as text, the number will be
left-aligned, but functions will continue to treat the entry as a value.
h Precede the number with an apostrophe. The apostrophe isn’t displayed, but the cell
entry will be treated as if it were text.
Even though a cell is formatted as Text (or uses an apostrophe), you can still perform some
mathematical operations on the cell if the entry looks like a number. For example, assume cell A1
contains a value preceded by an apostrophe. This formula displays the value in A1, incremented
This formula, however, treats the contents of cell A1 as 0:
To confuse things even more, if you format cell A1 as Text, the preceding SUM formula treats it as 0.
In some cases, treating text as a number can be useful. In other cases, it can cause problems.
Bottom line? Just be aware of Excel’s inconsistency in how it treats a number formatted as text.
When a number isn’t treated as a number
If you import data into Excel, you may be aware of a common problem: Sometimes, the
imported values are treated as text. Here’s a quick way to convert these nonnumbers to actual
values. Activate any empty cell and choose Home➜Clipboard➜Copy. Then, select the range that
contains the values you need to fix. Choose Home➜Clipboard➜Paste➜Paste Special. In the
Paste Special dialog box, select the Add option and then click OK. By “adding zero” to the text,
you force Excel to treat the nonnumbers as actual values.