Field Guide

Numbers stored as text in Excel: how to find and fix them

Updated

A number stored as text is a cell whose contents read as digits but whose type, as far as Excel is concerned, is a string. The fastest fix, in Excel for Windows: select the cells, click the error button that appears at the top left of the selection, and choose Convert to Number. The reason it is worth a whole page is the failure mode. Microsoft’s SUM documentation states it plainly: “SUM will ignore text values and give you the sum of just the numeric values.” A total over a column with two text entries in it is not an error, it is simply a smaller number, and nothing at the total says so.

That is the quiet-corruption pattern this page is about: how to spot text-numbers, the documented ways to convert them, and the cases where text is the correct type, because leading zeros vanish from numbers and 16-digit codes lose digits.

How to tell if a number is stored as text

B6
fx
=SUM(B2:B5)
A B
1 Invoice Amount
2 101 1,200
3 102 850
4 103 45
5 104 80
6 Total 2,050
B4 and B5 hold the text values 45 and 80, not numbers. SUM skips them and returns 2,050 instead of 2,175, with no error value anywhere in the sheet.

Excel gives you several tells, none of them loud.

fx
=ISTEXT(B4)

TRUE means the cell holds text, whatever it looks like. Its mirror, =ISNUMBER(B4), confirms a real number. These functions do not convert their argument first, so they report the cell’s actual type.

Why Excel stores numbers as text

Three causes account for nearly all of it.

Imported or pasted data. Microsoft’s guidance on text-formatted numbers notes the issue sometimes occurs after you import or copy data from a database or other external data source. CSV exports, reports pasted from a browser, and system extracts are the classic carriers: the digits arrive, the type does not.

The cell was formatted as Text before the value was typed. The Text number format tells Excel to store whatever is entered as entered. Apply it to a column, type numbers into it, and every one of them is a string. The same mechanism also catches formulas, which then display themselves instead of calculating; that sibling symptom has its own walkthrough.

A leading apostrophe. Typing an apostrophe in front of a number tells Excel to treat it as text. That is a deliberate feature, and later in this page it is the right tool. It only becomes a bug when the apostrophes arrive by accident, riding in with pasted data.

How to convert text to numbers

Three routes get you there: the error button’s Convert to Number, a VALUE helper column, and Paste Special’s multiply trick. Microsoft’s current support page documents the first two, and an older page it still hosts documents the third. All three end in the same place: the cell’s stored contents become a real number.

The error button: Convert to Number

In Excel for Windows, select the cells you want to convert, then click the error indicator at the top left of the selection, or press Alt+Shift+F10 to open the same menu from the keyboard. Choose Convert to Number and the green triangle warnings go with it. This is the fix for the common case: a block of imported values you can select in one drag.

If no error button appears, background error checking may be off. In Excel for Windows it lives under File > Options > Formulas, where Enable background error checking switches the indicators back on.

The VALUE function

Where the button is not available, including Excel for the web, the documented route is a helper column. VALUE converts a text string that represents a number into that number:

=VALUE(B4)
Returns the number 45 from the text in B4. If the text is not in a recognizable number, date, or time format, VALUE returns the #VALUE! error instead.

Insert a new column beside the text numbers, point =VALUE() at the first one, and fill it down by dragging the handle at the cell’s lower right corner. Then either use the new column directly or copy it and paste it over the original column as values (Paste Special > Values, or Ctrl+Shift+V), and delete the helper.

Paste Special, multiply by 1

An older Microsoft page documents a trick that converts in place without a helper column. Type 1 into a blank cell whose format is General and copy it. Select the cells holding text numbers, open Home > Paste > Paste Special, choose Multiply under Operation, and click OK. Multiplying by 1 leaves every value looking identical, but the arithmetic forces Excel to replace each cell’s text contents with the numeric equivalent. Delete the cell with the 1 when you are done.

Why setting the format to General is not enough

The instinctive fix, select the column and switch its format from Text to General, changes nothing you can see, because a format change alone does not re-enter what the cells already store. Microsoft’s fix for the formula version of this problem makes the point: set the format to General, then press F2 and Enter, re-entering the contents under the new format. The same rule cuts the other way too: Microsoft’s leading-zeros guidance notes that applying the Text format does not change numbers already entered, only entries made after the format is applied. The format decides how an entry is stored at the moment it is entered. For anything already in the grid, use one of the three conversions above, which exist precisely so you do not have to retype a thousand cells.

When text is the right answer: keeping leading zeros

Some digits are codes, not quantities. Zip codes, phone numbers, part numbers, and account codes are the usual cases, and Excel’s defaults fight you on them: per Microsoft, “Excel automatically removes leading zeros, and converts large numbers to scientific notation, like 1.23E+15, in order to allow formulas and math operations to work on them.”

There are two documented ways to keep the zeros, and they differ in what the cell ends up holding.

A custom number format keeps the value numeric. Select the cells, press Ctrl+1 to open Format Cells, and on the Number tab choose Custom. A format of 00000 pads every entry to five digits for a postal code; Microsoft’s own example is 000-00-0000 for a social security number.

A B
1 Office Postal code
2 Holtsville 00501
3 Adjuntas 00601
4 Boston 02110
The cells hold the numbers 501, 601, and 2110; the custom format 00000 pads the display to five digits. The values stay numeric, so lookups and calculations still see numbers.

The Text format, or an apostrophe, keeps the zeros as text. Format the cells as Text before entering the data (Ctrl+1, Number tab, Text), or type an apostrophe in front of an individual entry, and Excel stores the characters exactly as typed. Remember the caveat from the previous section: the Text format only governs entries made after it is applied. For imported files, the same choice exists at the door; in the Get & Transform (Power Query) import experience you can set a column’s data type to Text before the data ever lands in the grid, which is the reliable way to bring in zip-code columns from a CSV.

Which to pick? If the codes ever feed arithmetic or numeric lookups, the custom format wins, because the underlying values stay numbers. If the codes are identifiers that must round-trip exactly, text is honest about what they are. Just make the choice deliberately, per column, so it does not get made for you cell by cell.

Long numbers, scientific notation, and the 15-digit limit

Two separate things happen to long numbers, and only one of them is cosmetic.

The cosmetic one: in the General format, Excel displays large numbers of 12 or more digits in exponential notation, so a perfectly healthy 12-digit account number shows up in 1.23E+11 style instead of as its digits. Applying a different number format, such as Number, brings the digits back, and per Microsoft, changing the number format leaves the value Excel actually calculates with untouched. If your long number has 15 digits or fewer, this is purely a display problem with a display fix.

The destructive one: Excel’s calculation precision is 15 significant digits. Type a number with 16 or more digits, a credit card number being the standard example, and every digit past the 15th is rounded down to zero. Microsoft is unambiguous that number codes of 16 digits or more must use a text format.

4111111111111110
A 16-digit card number ending in 1, typed into a number-formatted cell. Excel keeps 15 significant digits, so the 16th digit is stored as 0. Format the cell as Number to see it; no format change brings the original digit back.

The order of operations is the trap. Formatting the cell as Text after typing does not help, because the trailing digits became zeros at entry, and a format change does not alter the stored value. The cells have to carry the Text format, or the entries a leading apostrophe, before the long codes go in. This is also why a scan of an unfamiliar workbook treats long-number columns with suspicion: a column of card numbers or reference codes stored as numbers has already lost data, silently, in a way no amount of reformatting reveals.

What breaks downstream

A handful of text-numbers radiates failures that surface far from the cells themselves.

The short version

The type of a cell is invisible in a printout and in most reviews, which is what makes this failure quiet. When a file that used to total correctly comes back from a re-import or another team and reads low, compare the two versions: the comparison flags a cell that changed from a number to text as its own finding, so the corrupted cells name themselves instead of hiding among thousands of unchanged ones.

Frequently asked questions

How do I convert text to numbers in Excel?
The fastest way in Excel for Windows: select the cells, click the error indicator that appears at the top left of the selection (or press Alt+Shift+F10), and choose Convert to Number. Where the button does not appear, put =VALUE(A2) in a helper column, fill it down, then paste the results back over the originals as values. A third documented route is Paste Special: copy a cell containing 1, select the text numbers, and use Paste Special with the Multiply operation.
Why does Excel store some numbers as text?
Microsoft notes this sometimes happens after you import or copy data from a database or another external source. It also happens when a cell carried the Text number format before the value was typed, and when an entry starts with an apostrophe, which tells Excel to treat what follows as text on purpose.
Why is my SUM total lower than it should be?
SUM ignores text values and adds only the numeric ones, so a column with a few numbers stored as text produces a smaller total with no error anywhere. Check the column with =COUNT(range) against =COUNTA(range): COUNT counts only numeric values, so if it comes up short on a column that should be all numbers, the difference is your text entries.
How do I keep leading zeros in Excel?
Two ways, with different results. A custom number format such as 00000 pads the display to five digits while the cell keeps a real number, so the value still works in calculations. Formatting the cells as Text before you type (or prefixing each entry with an apostrophe) stores the zeros as typed but makes the entries text. Note that applying the Text format does not change numbers already entered; it only affects entries made after the format is applied.
How do I get rid of scientific notation in Excel?
The General format displays large numbers of 12 or more digits in exponential notation, in the 1.23E+11 style. To see all the digits, apply a different number format, such as Number; the display changes but the stored value does not. The exception is codes of 16 digits or more: Excel keeps only 15 significant digits, so those must be entered into Text-formatted cells, because by the time you reformat, the trailing digits have already become zeros.
Why doesn't changing the format to General fix numbers stored as text?
Because a format change alone does not re-enter what the cell already stores. Microsoft's own fix for the equivalent formula problem is to set the format to General and then press F2 and Enter, re-entering the contents under the new format. For whole columns of values, Convert to Number, VALUE, or the Paste Special multiply trick do the conversion without retyping.
What does the green triangle in the corner of an Excel cell mean?
It is Excel's error-checking indicator, and numbers stored as text are one of the things it often marks. Select the flagged cells and click the error button to see the options, including Convert to Number. In Excel for Windows the checking rules live under File, Options, Formulas, where background error checking can be switched on or off.

Catch the errors before they ship

Reviewing a change to a model? Compare the two versions in your browser and see every changed cell, formula, and value. It's free, and nothing leaves your computer.