PDA

View Full Version : Solved: Excel 2003 - Need to sum numbers that are in cells formated as text



frank_m
12-14-2010, 02:06 AM
I'm using the code shown below to give a sum total in Cell P18 by adding the number value in Cell i18 to Cell P18

It works fine as long as both cells are formatted as a number or general, but if the cells accidentally become formatted as text the result is concatenation instead of summing.

Is there an alternative command that will sum the two numbers regardless of the cell formatting?
Range("P18").Value = Range("P18").Value + Range("I18").Value

xld
12-14-2010, 02:33 AM
Range("P18").Value = Val(Range("P18").Value) + Val(Range("I18").Value)

frank_m
12-14-2010, 02:55 AM
Thanks once again xld. -- Without you and the other great experts at this forum I'd never be able to get a project completed and bug free before the "frustration" and "taking too long" factor's would overwhelm me.

In other words instead of me being like this -> :banghead:
--> you enable me to be at -> :cloud9: and finding some enjoyment with the task, as well as getting enough rest.

xld
12-14-2010, 02:59 AM
That's the whole aim Frank, to help you along the road we previously travelled :)