Home » excel » Convert text to number format in Excel

Convert text to number format in Excel

Posted by: admin March 9, 2020 Leave a comment

Questions:

How can I convert text representations of numbers into Excel numbers, especially negative values? For example, the string “9,669.34” (without quotes) should become the number 9,669.34 and the string “2,553.57-” (again, without quotes) should become the number (2,553.57).

When I used the formula =SUBSTITUTE(A1,CHAR(160),"")+0, it worked well, but only for positive values. I received the result #VALUE! for all negative values.

How to&Answers:

For (2,553.57), you can use VALUE, such as VALUE("(2,553.57)").

Excel doesn’t seem to recognize 2,553.57- as a valid number when it is a string, so assuming you have a value of “2,553.57-” in A1, you would have to do a little more work:

=VALUE(IF(RIGHT(A2,1)=”-“,”-“&SUBSTITUTE(A2,”-“,””)))

EDIT

=VALUE(IF(RIGHT(A2,1)="-","-"&SUBSTITUTE(A2,"-",""),A2))

From the Microsoft site:

  • Text can be in any of the constant number, date, or time formats recognized
    by Microsoft Excel. If text is not in one of these formats, VALUE returns the
    #VALUE! error value.
  • You do not generally need to use the VALUE function in a formula because Excel
    automatically converts text to numbers as necessary. This function is provided
    for compatibility with other spreadsheet programs.

More information can be found at Microsoft’s website: Value Function

Answer:

If you have a column of these text-based numbers, select the column and use Data ► Data Tools ► Text to Columns ► Fixed Width ► Finish. The trailing negative signs will be used to determine the sign of the resulting number, spaces (leading and/or trailing) will be removed and you will be left with raw numbers that you can apply a currency or number format to.

If the column is originally formatted as Text, change it to General before applying the Text to Columns command.

Answer:

Another option: Select the column. Copy. Paste Special with “Multiply” option.

Then, as above, you can select Currency or Number in the droplist, decimal places, etc.