Quote:
Originally Posted by Haha88
Hi,
I would like some help creating a formula where I can extract the number from the cell and convert it to number form so sum can be added.
I attached the data and the expect result.
Many thanks,
|
You can do this a bunch of different ways.
Immediately to the right of your column of numbers stored as text, type =VALUE(E5_ and copy down. Then select those cells and paste them back as values.
I used to keep a dirt-simple macro to do a whole sheet of numbers (TV ratings) stored as text, which simply replaced every digit 0 through 9 with itself. Doing that refreshed every cell with numbers in it, and would allow it to take number formatting, be summed, etc.
Sub replnos()
'
' replnos Macro
' Replace 0-9 with themselves to convert numbers stored as text to actual calculable numbers - Ann's cheat
'
' Cells.Replace What:="0", Replacement:="0", LookAt:=xlPart, SearchOrder _
:=xlByRows, MatchCase:=False, SearchFormat:=False, ReplaceFormat:=False
Cells.Replace What:="1", Replacement:="1", LookAt:=xlPart, SearchOrder _
:=xlByRows, MatchCase:=False, SearchFormat:=False, ReplaceFormat:=False
Cells.Replace What:="2", Replacement:="2", LookAt:=xlPart, SearchOrder _
:=xlByRows, MatchCase:=False, SearchFormat:=False, ReplaceFormat:=False
Cells.Replace What:="3", Replacement:="3", LookAt:=xlPart, SearchOrder _
:=xlByRows, MatchCase:=False, SearchFormat:=False, ReplaceFormat:=False
Cells.Replace What:="4", Replacement:="4", LookAt:=xlPart, SearchOrder _
:=xlByRows, MatchCase:=False, SearchFormat:=False, ReplaceFormat:=False
Cells.Replace What:="5", Replacement:="5", LookAt:=xlPart, SearchOrder _
:=xlByRows, MatchCase:=False, SearchFormat:=False, ReplaceFormat:=False
Cells.Replace What:="6", Replacement:="6", LookAt:=xlPart, SearchOrder _
:=xlByRows, MatchCase:=False, SearchFormat:=False, ReplaceFormat:=False
Cells.Replace What:="7", Replacement:="7", LookAt:=xlPart, SearchOrder _
:=xlByRows, MatchCase:=False, SearchFormat:=False, ReplaceFormat:=False
Cells.Replace What:="8", Replacement:="8", LookAt:=xlPart, SearchOrder _
:=xlByRows, MatchCase:=False, SearchFormat:=False, ReplaceFormat:=False
Cells.Replace What:="9", Replacement:="9", LookAt:=xlPart, SearchOrder _
:=xlByRows, MatchCase:=False, SearchFormat:=False, ReplaceFormat:=False
End Sub
You can also highlight the cells and use Data/Text to Columns, and without changing delimited/fixed width, just hit Finish. This always made me too nervous with consecutive columns of data, I was afraid it would parse on something like a space and cover up the next column of stuff, so I just used my cheat macro as I was certain it would stay in the same cell.