View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
ryguy7272 ryguy7272 is offline
external usenet poster
 
Posts: 2,836
Default adding numbers with letters

Try this UDF:

Function SumCharacters(Rng As Range) As Long

Dim i As Long
Dim s As String
Dim lSum As Long
Dim mycell As Range

lSum = 0
For Each mycell In Rng.Cells
For i = 1 To Len(mycell.Value)
s = Mid(mycell.Value, i, 1) 'mycell.text if it's formatted
If IsNumeric(s) Then
lSum = lSum + s
End If
Next i
Next mycell

SumCharacters = lSum
End Function



Regards,
Ryan--


--
RyGuy


" wrote:

How do you add numbers in a cell with letters mixed?
such as:

160grn+4wht+17grn

Thanx in advance for your help!