View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Niek Otten
 
Posts: n/a
Default How do I extract numbers from a cell with both text and numbers?

You could use this User defined Function:

Function StripTxt(a As String) As String
' Strips all non-numeric characters from a string
' Returns a string, not a number!
Dim i As Long
Dim b As String
For i = 1 To Len(a)
b = Mid$(a, i, 1)
If Asc(b) 47 And Asc(b) < 58 Then StripTxt = StripTxt + b
Next i
End Function

If you're new to VBA, look he

http://www.mvps.org/dmcritchie/excel/getstarted.htm


--
Kind regards,

Niek Otten

"SHANNON" wrote in message
...
Examples:
AA100.10
ANN242.21