Sub topic 12
Numbers That Stay Text After Cleaning
This chapter assumes you can enter and copy formulas, use relative references such as A2, and tell text from numbers in a cell. It also assumes you have used TRIM, CLEAN, SUBSTITUTE, and Paste Special as covered in earlier chapters.
Why cleaned numbers still behave like text
TRIM, CLEAN, and PROPER all return text. That is correct for names, but it is a problem for values such as 1,234.50 or 42. After cleaning, the cell looks right, yet SUM skips it, a lookup against a numeric column fails, and sorting puts 100 before 9.
A text value that looks like a number is a "number stored as text". Cleaning can cause this and can also fail to cure it. Three situations are common:
- The data arrived as text, with spaces or hidden characters around the digits. Removing the characters leaves a text result.
- The cell was formatted as Text before the data or formula was entered. Excel then keeps whatever you enter as text, and a formula typed into such a cell shows as literal formula text.
- The text uses a different decimal or thousands separator than your system expects, so Excel can't read it as a number.
Cleaning removes the extra characters. Converting changes the data type. Those are separate steps, and you usually need both.
Recognizing the symptoms
Check for these signs before you write any formula:
- The value is left-aligned in a General-format cell. Numbers right-align by default.
- A small green triangle appears in the corner, with the warning "Number Stored as Text".
- The status bar shows a Count that is larger than the Sum suggests, or no Sum at all for the selection.
=SUM(B2:B10)returns less than expected or returns 0.
Formulas give a more reliable test than appearance, because alignment can be overridden by formatting.
=ISNUMBER(B2)This returns TRUE only when B2 holds a real number. To check a whole column, compare how many cells COUNT sees as numbers against how many are non-empty.
=COUNTA(B2:B100)-COUNT(B2:B100)A result above 0 means some non-empty cells are text, or are errors that COUNT also skips. Remember that header text and notes in the range count toward this difference.
Converting with VALUE
VALUE turns a text string that looks like a number into a number. Nest your cleaning formula inside it so spaces and hidden characters are gone before the conversion.
=VALUE(TRIM(CLEAN(SUBSTITUTE(A2,CHAR(160)," "))))The order matches the earlier chapters. SUBSTITUTE handles non-breaking spaces, CLEAN removes control characters, TRIM removes the remaining extra spaces, and VALUE converts the result.
VALUE accepts formats that Excel would accept if you typed them into a cell. In a US-style locale, "$1,234.50", "12%", and "3/15/2026" all convert. A percentage becomes a fraction (0.12) and a date becomes a serial number, so format the result cells accordingly.
The shorter coercions
You will see these alternatives, which force a conversion through arithmetic:
=--TRIM(A2)
=TRIM(A2)*1
=TRIM(A2)+0They give the same result as VALUE for ordinary numbers. VALUE is easier to read in a shared workbook, because the intent is stated by name. Use the arithmetic forms only if your team already does.
Handling blanks
Applied to an empty string, VALUE returns #VALUE!. A cell that looks empty after cleaning is a common cause. Handle blanks in a separate step so you don't hide other errors:
=IF(B2="","",VALUE(B2))Here B2 is a helper column holding the cleaned text. Avoid wrapping the whole formula in IFERROR. It would also hide real problems, such as a stray letter in a column of amounts.
Handling separators with NUMBERVALUE
Imported data often uses separators that differ from your system settings. A European export may write 1.234,50, meaning 1,234.50. On a US-locale system, VALUE can't read that text as a number. NUMBERVALUE lets you state the separators yourself.
=NUMBERVALUE(B2,",",".")The second argument is the decimal separator and the third is the group (thousands) separator. NUMBERVALUE ignores ordinary spaces anywhere in the text, so "1 234,50" also works with a comma as the decimal separator. It reads a trailing percent sign as a percentage. It is available in Excel 2013 and later.
NUMBERVALUE does not treat a non-breaking space (character 160) as an ordinary space. Run SUBSTITUTE first:
=NUMBERVALUE(SUBSTITUTE(A2,CHAR(160),""),",",".")Note that an empty string returns 0 from NUMBERVALUE, not an error. A blank that silently becomes 0 can distort averages, so check for blanks first.
Choosing a method
| Situation | Best approach |
|---|---|
| Text has spaces or hidden characters around digits | `VALUE(TRIM(CLEAN(...)))` in a helper column |
| Separators differ from your locale | `NUMBERVALUE` with explicit separators |
| Text is already clean, and you want to fix it in place | Text to Columns or Paste Special Multiply |
| Values are identifiers such as ZIP codes or part numbers | Leave as text, and match types in lookups |
The following diagram shows the decision path.
Converting without formulas
If the text is already clean, a formula is more than you need. Two built-in tools convert values in place.
Text to Columns
- Select the column of text numbers.
- On the Data tab, choose Text to Columns.
- Choose Finish on the first step without changing any options.
Excel re-reads each cell as if you had typed it, so numbers and dates become real values. This works on one column at a time, and the destination cells must not be formatted as Text.
Paste Special with Multiply
- Type 1 in an empty cell and copy it.
- Select the cells holding text numbers.
- Choose Paste Special, then Multiply, then OK.
Multiplying by 1 forces the conversion and leaves the value unchanged. Delete the helper 1 afterwards.
Both methods fail on cells formatted as Text, because Excel still treats the contents as text. Change the format to General first. Then re-enter the values, for example by pressing F2 and Enter on a cell, or by running Text to Columns.
Fixing the format first
If a helper column shows formulas as text instead of results, the column is formatted as Text. Follow these steps:
- Select the column and set the number format to General.
- Re-enter each formula. Pressing F2, then Enter, works for a single cell.
- Copy the formula down again, or double-click the fill handle.
Changing the format alone does not recalculate cells that already hold text. Excel applies the new format only when the cell is entered again.
Leading zeros, identifiers, and lookups
Not every number-like value should become a number. ZIP codes, phone numbers, account numbers, and part numbers are labels, not quantities. VALUE("00123") returns 123 and drops the leading zeros. If you later need the zeros, you must restore them with a number format or the TEXT function.
=TEXT(C2,"00000")The more common problem is a type mismatch in a lookup. Suppose a lookup table stores ID 123 as the number 123, but your cleaned data holds the text "123". XLOOKUP and VLOOKUP report no match, even though the cells look identical. Convert one side so both have the same type:
=XLOOKUP(VALUE(B2),Table1[ID],Table1[Name])If the table stores IDs as text, go the other way and convert your key to text instead.
=XLOOKUP(TEXT(B2,"0"),Table1[ID],Table1[Name])Check the type with =ISTEXT(Table1[@ID]) or by looking at the alignment, and convert the side that is easier to change.
Negative numbers with a trailing minus
Some systems export negatives as 125- instead of -125. VALUE returns #VALUE! for this form. Text to Columns can fix it through its Advanced options. A formula can do the same job:
=IF(RIGHT(B2,1)="-",-VALUE(LEFT(B2,LEN(B2)-1)),VALUE(B2))Here B2 is the cleaned text. The formula strips the final minus sign and reapplies it as a sign.
Finishing the job
Once the helper column holds real numbers, the usual finish applies. Copy the helper column and use Paste Special, Values to replace the formulas. Then apply a number format to control decimals and currency display. Pasting values does not change the data type, so a value that is a number in the helper column stays a number after the paste.
Run =COUNTA(...)-COUNT(...) on the result as a last check. It should return 0 unless you deliberately left identifiers as text.
Exercise
Column A holds the text " 1 250,75" with a non-breaking space before the 1, a normal space between 1 and 250, and a comma as the decimal separator. Write one formula that returns the number 1250.75 on a system that uses a period as the decimal separator.
Show answer
=NUMBERVALUE(SUBSTITUTE(A2,CHAR(160),""),",",".") works, because SUBSTITUTE removes the non-breaking space, NUMBERVALUE ignores the ordinary space, and the second and third arguments declare the comma as decimal and the period as group separator. A version that replaces CHAR(160) with a normal space also works, since NUMBERVALUE ignores ordinary spaces.
Exercise
A lookup returns #N/A even though the key 4471 clearly appears in both the data and the lookup table. ISNUMBER on your key returns FALSE and ISNUMBER on the table key returns TRUE. What is the cause, and what is the fix?
Show answer
Your key is the text "4471" and the table key is the number 4471, so the lookup finds no match. Convert your key with VALUE (or --) so both sides are numbers, for example =XLOOKUP(VALUE(B2),Table1[ID],Table1[Name]). If the key had a leading space or non-breaking space, clean it first with TRIM and SUBSTITUTE before VALUE.
Exercise
You formatted column C as Text, entered =VALUE(TRIM(B2)), and the cell shows the formula itself instead of a result. List the steps to fix it.
Show answer
Set the column's number format to General, then re-enter each formula, for example by pressing F2 and then Enter on the cell, and copy the formula down again. Changing the format alone does not recalculate cells that already contain text.