Menu

How to Convert Text to Numbers in Excel: VALUE and More

=VALUE(A2) turns a number stored as text, such as '120, into the number 120. Two minus signs, =--A2, do the same, NUMBERVALUE handles commas as decimal separators, and Convert to Number fixes cells in place.

Every sheet on this page is live: change a number or a formula and it recalculates.

=VALUE(A2) converts a number stored as text in A2 into a real number. Text numbers look normal, but SUM, AVERAGE and COUNT skip them, which is why a total can come out as 0:

SUM skips numbers stored as text
C2
ABC
1ImportedVALUE
2120120
38585
4240240
51515
60460
Click a cell to see its formula. Change a number or a formula and the sheet recalculates.

A6 totals 0 because the four cells in column A are text (typed with an apostrophe, as data imported from a CSV or a web page often is). Column C converts each one and C6 gives the real total, 460.

How to tell a number is stored as text

In Excel a number stored as text:

  • sits at the left of the cell, where numbers sit at the right (unless the alignment was changed);
  • shows a small green triangle in the cell's top-left corner, and a warning icon when you select it, saying "Number Stored as Text";
  • is counted by COUNTA but not by COUNT.
Find the text numbers
B2
ABCDE
1ValueISNUMBERISTEXTText numbers
2120TRUEFALSE2
385FALSETRUE
4240TRUEFALSE
515FALSETRUE
Click a cell to see its formula. Change a number or a formula and the sheet recalculates.

E2 counts how many cells in the range are filled but not numbers: here the two typed with an apostrophe. On a clean column of numbers it returns 0.

Four formulas that convert

Same result, four ways
B2
ABC
1TextResultHow
212501250VALUE
31250double minus
41250multiply by 1
51250add 0
Click a cell to see its formula. Change a number or a formula and the sheet recalculates.

Any arithmetic forces Excel to read the text as a number, and VALUE is the explicit version. -- (two minus signs: minus, then minus again) is the common choice inside other formulas, because it is short: =SUMPRODUCT(--A2:A5) adds a column of text numbers without a helper column. VALUE also reads text with a currency sign, thousands separators or a percent sign: VALUE("$1,250") is 1250 and VALUE("12%") is 0.12.

Convert the quantity
B2
AB
1Quantity (text)Quantity
2125
Click a cell to see its formula. Change a number or a formula and the sheet recalculates.

Your turn: The quantity in A2 was imported as text. In B2, convert it to a number.

Text with units or other separators

VALUE returns #VALUE! when the text has anything it cannot read as a number. Two common cases:

Units and European separators
B2
ABC
1TextFixedWithout the fix
2120 kg120#VALUE!
31.234,51234.5#VALUE!
Click a cell to see its formula. Change a number or a formula and the sheet recalculates.
  • A unit or a word: remove it first with SUBSTITUTE, as in B2.
  • A comma as the decimal separator, as in 1.234,5 from a German or Brazilian system: NUMBERVALUE (Excel 2013 and later) takes the decimal separator and the group separator as its second and third arguments. VALUE only knows the separators of your own Excel, so C3 fails.

Spaces before or after the digits do not stop VALUE, but non-breaking spaces from web pages can; SUBSTITUTE(A2,CHAR(160),"") removes them first. For the general causes of this error, see #VALUE!.

Total the text amounts
B2
AB
1AmountTotal
2120
345
480
Click a cell to see its formula. Change a number or a formula and the sheet recalculates.

Your turn: The amounts in A2:A4 are numbers stored as text. In B2, return their total with one formula.

Convert in place without a formula

Formulas put the numbers in a new column. To fix the cells themselves:

  1. Convert to Number. Select the cells (the first selected cell must be one with the green triangle), click the warning icon next to the selection, and choose Convert to Number. This is the quickest fix.
  2. Text to Columns. Select the column, Data > Text to Columns, and click Finish straight away. Excel re-enters every cell and turns the text numbers into numbers.
  3. Paste Special, Multiply. Type 1 in an empty cell and copy it. Select the text numbers, Home > Paste > Paste Special, choose Multiply, click OK.

If the cells are formatted as Text (Home > Number Format shows "Text"), set them to General first; otherwise anything you type into them is stored as text again.

Common mistake: lookups between text and numbers

A lookup value of 101 does not match the text 101: VLOOKUP, XLOOKUP and MATCH return #N/A, and =A2=101 is FALSE, even though both cells look the same. Convert one side so both are the same type. When the lookup column is the text one, convert the value you look up instead:

=VLOOKUP(TEXT(E2,"0"), A2:C6, 3, FALSE)   E2 is a number, column A holds text numbers
=VLOOKUP(--E2, A2:C6, 3, FALSE)           E2 holds a text number, column A holds numbers

The ISNUMBER and ISTEXT page shows how to check each side.

Frequently Asked Questions

How do I convert text to a number in Excel?

With a formula, =VALUE(A2) or =--A2. Without a formula, select the cells, click the warning icon that appears next to them and choose Convert to Number.

Why does SUM return 0 in Excel?

The numbers are stored as text, and SUM skips text. They are usually aligned to the left and show a small green triangle. Convert them with =VALUE(A2), or add them directly with =SUMPRODUCT(--A2:A10).

Why does Convert to Number not work or not appear?

Excel offers it only for text it can read as a number. A non-breaking space from a web page, a unit such as kg or a decimal comma your Excel does not use hides the green triangle. Clean the text first: =VALUE(SUBSTITUTE(A2,CHAR(160),"")) or =NUMBERVALUE(A2,",",".").

How do I convert numbers with a comma as decimal separator?

Use NUMBERVALUE and name the separators: =NUMBERVALUE(A2,",",".") turns 1.234,5 into 1234.5. VALUE only understands the separators of your own Excel settings.

Coddy programming languages illustration

Learn to code with Coddy

GET STARTED