Excel Text to number conversion

First some background

So I got bored and decided I wanted to look for sites that graphically tracked the change in a stocks EPS over time. I really want to track atleast 5 years worth of data so I have enough data points. www.earnings.com gives me the necessary data however when i cut and paste the earnings history into excel for some reason the earnings figures are pasted as text or something that doesnt allow me to treat them as I otherwise a number.

For example

A1= $0.27 A2= $0.35

I want to add A1 and A2, however when i do it simply displays it as #VALUE

I have tryed using text to column, I have tryed multiplying the selected cells by 1, and i have even tryed the following macro.

  Sub Enter_Values()
      For Each xCell In Selection
          xCell.Value = xCell.Value
      Next xCell
  End Sub

How do I convert these so i can run operations on the data?! Thanks.

14 Comments
 

After playing around with it some more it appears that what is causing the problem is a space at the end of the string. For some reason when i use the TRIM function it still does not work correctly. Again any help would greatly be appreciated. I have ran into this problem many times and I absolutely hate having go through my hand and retype it.

"Oh the ladies ever tell you that you look like a fucking optical illusion" - Frank Slaughtery 25th Hour.
 

I actually found a macro to remove all spaces. It worked.

"Oh the ladies ever tell you that you look like a fucking optical illusion" - Frank Slaughtery 25th Hour.
 
Best Response

http://www.mvps.org/dmcritchie/excel/join.htm#trimall

Used this code

Sub RemoveAllSpaces() 'David McRitchie 2000-10-24 Application.ScreenUpdating = False Application.Calculation = xlCalculationManual Selection.SpecialCells(xlConstants).Replace What:=Chr(160), _ Replacement:="", _ LookAt:=xlPart, SearchOrder:=xlByColumns, MatchCase:=True Selection.SpecialCells(xlConstants).Replace What:=Chr(32), _ Replacement:="", _ LookAt:=xlPart, SearchOrder:=xlByColumns, MatchCase:=True Application.Calculation = xlCalculationAutomatic Application.ScreenUpdating = True End Sub

Pretty helpfull feature, if you need to pull large amounts of data from tables on web sites and when you cut and paste it comes out as HTML and not numbers this will fix the problem. This will save me hours.

Now i just cant figure out how to save the macro for general use. since it will be something i do pretty common.

"Oh the ladies ever tell you that you look like a fucking optical illusion" - Frank Slaughtery 25th Hour.
 

Correction:

Sub ConvertToNum() Dim bCell As Range, TheNum As String For Each bCell In Selection TheNum = Replace(bCell, " ", "") TheNum = Replace(TheNum, "$", "") bCell.Value = CDbl(TheNum) bCell.NumberFormat = "0.00" Next bCell End Sub

elanSub ConvertToNum() Dim bCell as Range, TheNum as String For Each bCell in Selection TheNum = Replace(Range(bCell).value, " ", "") TheNum = Replace(TheNum,"$", "") Range(bCell).value = cdbl(TheNum) Next bCell End Sub

Assign an easy short-cut key to your macro, makes it alot easier. That should work on every cell in the range you select.

 

Elan- I cant figure out how to assign a short cut key to the macro. Im still very new to VBA and macros but as i tend to need more features i learn new things.

Stern- I was drinking when i did this.... (excel)models & bottles BABY! Ohhhh yeah.

"Oh the ladies ever tell you that you look like a fucking optical illusion" - Frank Slaughtery 25th Hour.
 

ALT+T+M+M or Alt+F8 or goto TOOLS in the menu, then MACRO then MACROS

Once the Macro dialog window comes up, select the macro you want to assign a shortcut key to and then click the OPTIONS button or hit ALT+O. This will let you assign a shortcut key to the macro. VERY VERY helpful.

CTRL+ whatever key you assign

trade4sizeElan- I cant figure out how to assign a short cut key to the macro. Im still very new to VBA and macros but as i tend to need more features i learn new things.

Stern- I was drinking when i did this.... (excel)models & bottles BABY! Ohhhh yeah.

 

Tenetur voluptates quasi commodi corporis. Sed ut sed vel repellendus. Cumque unde et et nihil. Quas ratione ut aspernatur et. Est sit molestiae debitis sit consequatur.

Et et distinctio esse repellat enim deserunt. Provident id quia nisi. Saepe quia dicta accusamus in enim est. Officiis aliquid et optio numquam temporibus placeat praesentium.

Vel possimus cupiditate autem autem sed cum autem. Molestiae qui dolores odit et ex.

Vel rerum sed voluptatem et fuga ab. Doloribus quidem aut maiores vitae ipsam.

"Oh the ladies ever tell you that you look like a fucking optical illusion" - Frank Slaughtery 25th Hour.

Career Advancement Opportunities

June 2026 Investment Banking

  • Evercore 01 99.4%
  • Moelis & Company 01 98.8%
  • JPMorgan 01 98.2%
  • Guggenheim Partners 01 97.7%
  • Morgan Stanley 07 97.1%

Overall Employee Satisfaction

June 2026 Investment Banking

  • Moelis & Company No 99.4%
  • Morgan Stanley 02 98.8%
  • Evercore 01 98.2%
  • BMO Capital Markets 12 97.6%
  • Banco Santander 01 97.1%

Professional Growth Opportunities

June 2026 Investment Banking

  • Moelis & Company No 99.4%
  • Evercore No 98.8%
  • Morgan Stanley 05 98.2%
  • JPMorgan No 97.7%
  • BMO Capital Markets 12 97.1%

Total Avg Compensation

June 2026 Investment Banking

  • Vice President (14) $434
  • Associates (43) $259
  • 3rd+ Year Analyst (8) $210
  • 2nd Year Analyst (22) $179
  • Intern/Summer Associate (13) $156
  • 1st Year Analyst (75) $151
  • Intern/Summer Analyst (68) $101
notes
16 IB Interviews Notes

“... there’s no excuse to not take advantage of the resources out there available to you. Best value for your $ are the...”

Leaderboard

1
redever's picture
redever
99.2
2
kanon's picture
kanon
99.0
3
Secyh62's picture
Secyh62
99.0
4
BankonBanking's picture
BankonBanking
99.0
5
dosk17's picture
dosk17
98.9
6
Betsy Massar's picture
Betsy Massar
98.9
7
DrApeman's picture
DrApeman
98.9
8
CompBanker's picture
CompBanker
98.9
9
GameTheory's picture
GameTheory
98.9
10
numi's picture
numi
98.8
success
From 10 rejections to 1 dream investment banking internship

“... I believe it was the single biggest reason why I ended up with an offer...”