View Single Post
  #5   Report Post  
Bob Phillips
 
Posts: n/a
Default

Andy,

There must be a worksheet function way of doing this, but it's simple with
a UDF

Function CountNum(rng As Range, Optional delimiter As String = ",")
Dim iPos As Long
Dim istart As Long
Dim tmp

If rng.Cells.Count 1 Then
CountNum = CVErr(xlErrRef)
Exit Function
End If
istart = 1
For iPos = 1 To Len(rng.Value)
If Mid(rng.Value, iPos, 1) = delimiter Then
tmp = tmp + CDbl(Mid(rng.Value, istart, iPos - istart))
istart = iPos + 1
End If
Next iPos
If Right(rng.Value, 1) < delimiter Then
tmp = tmp + CDbl(Mid(rng.Value, istart, iPos - istart))
End If
CountNum = tmp
End Function

Call it like so

=countnum(AA1,";")

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Andy Brown" wrote in message
...
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