Fix numbers stored as text and hidden characters
Clean up messy data8 minPremium
Builds on Turn numbers into text and back with TEXT and VALUE and Swap text with SUBSTITUTE and REPLACE.
A finance analyst in Toronto copies the month's card transactions from her bank's website into Excel. The amounts look fine, but the total under them says $0.00, and her lookup by amount finds nothing.
How it works
A number stored as text looks like a number, but Excel holds it as text, so SUM and AVERAGE pass over it and a lookup for the number 1250 won't match the text "1250". You can tell by these signs: it sits at the left of the cell, a small green triangle marks the cell's corner with the warning Number Stored as Text, ISNUMBER returns FALSE, and the status bar shows a Count for the cells but no Sum.
Most of them convert in one go. Select the cells, click the warning button beside them and choose Convert to Number. In a formula, VALUE does the same job.
When a value still won't convert, the text holds something you can't see:
| Row | A | B | C |
|---|---|---|---|
| 1 | Hidden in the text | Where it comes from | What removes it |
| 2 | A nonbreaking space, character 160 | Web pages | SUBSTITUTE with CHAR(, since TRIM leaves it |
| 3 | A line break | Text copied from emails | CLEAN |
| 4 | A decimal comma, as in 1.250,50 | Systems set up for Europe | NUMBERVALUE, given the comma and the period |
Example
Three amounts copied from different places, tested with ISNUMBER in column B and converted in column C:
Common mistakes
=VALUE(on the amount from the web page returnsTRIM( A3)) #VALUE!. TRIM removes ordinary spaces only. Swap the nonbreaking space out withSUBSTITUTE(first.A3, CHAR( 160), "") - A new number format on the cells. A format changes how a value looks, and text stays text until it's entered again or converted.
=VALUE(on 1.250,50 in Excel set to US English returnsA4) #VALUE!, since a period is the decimal point there. NUMBERVALUE reads the separators you give it.- Ignore Error on the green triangle. The warning goes away, and the text still doesn't add up.
In short
- Text that looks like a number sits at the left, carries a green triangle and doesn't add up.
- Convert to Number or VALUE fixes the plain ones.
- Remove nonbreaking spaces with SUBSTITUTE and CHAR(160), and line breaks with CLEAN, before VALUE.
- NUMBERVALUE reads numbers written with a decimal comma.
Practice
Premium4 exercises: 3 formulas and 1 quiz question.
Practice is part of Premium
Every lesson is free to read, and you can practice the free lessons without an account. This lesson's exercises are part of Premium, which you add to a free account.
Have one? Sign in