Thread: SEARCH FORMULA
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
Don Guillett Don Guillett is offline
external usenet poster
 
Posts: 10,124
Default SEARCH FORMULA

Sub getnum()
x = Range("a1")
For i = 1 To Len(x) - 1
If IsNumeric(Mid(x, i, 1)) Or _
Mid(x, i, 1) = "-" Then mn = mn & Mid(x, i, 1)
Next i
MsgBox mn
End Sub

'or put this in a regular module and use =gn(a1) if string is in cell a1
Function gn(x As Range)
For i = 1 To Len(x) - 1
If IsNumeric(Mid(x, i, 1)) Or _
Mid(x, i, 1) = "-" Then gn = gn & Mid(x, i, 1)
Next i
End Function

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Michel" wrote in message
...
Hi,

I need to get a number out of a cell with text. How should I make the
formula ?

Eg. :

A1 A2 (RESULT)
hjjkhkjkhkj1000-841jkjkjrkjrkj 1000841

Many thanks in advance!

Michel