View Single Post
  #2   Report Post  
Naz
 
Posts: n/a
Default

Hi Andy,

Unfotunately it is not possible to do what you want without code. Although
it seems like its possible, Excel won't evalute that formula to read a new
formula. Your options would be;

1) Use just the subsitute part of the formula and then maually put in the "=".
2) Use the find and replace to remove the "," and then again manually put
the "=" in. The advantage is u save a column.
3) Use the text to columns tool, to split the contents of the cells, then
put a sum formula in, though this is only practical if you don't have a large
number of delimited numbers.

If you do decide that you want to use code, paste this into a new module.
Then select the cells and run the macro.

Sub ChangeToFormula()

Dim Rng As Range

For Each Rng In Selection.Cells
Rng.Formula = WorksheetFunction.Substitute(Rng, ",", "+")
Rng.Formula = "=" & Rng.Text
Next Rng

End Sub

Hope that helps

______________________
Naz
London

"Andy Brown" wrote:

If I have "0.120;0.140;0.200" in a cell, is it possible to get the sum of
the values with a formula (NB: not code)?

=INDIRECT("="&SUBSTITUTE(A1,";","+")) just equals #REF!

TIA,
Andy