I need to extract a number from a text string, then list
the number in a diffrent cell.
Please Help.
pnoel
This VBA routine might work for you. It will extract all of the numeric
characters from a string:
====================
Function GetValue(str)
Dim N As Integer, i As String
i = ""
For N = 1 To Len(str)
If IsNumeric(Mid(str, N, 1)) Then
i = i & Mid(str, N, 1)
If Mid(str, N + 1, 1) = "." Then i = i & "."
End If
Next
If i = "" Then
GetValue = i
Exit Function
End If
GetValue = CDbl(i)
End Function
================
To enter it, <alt><F11> opens the VB Editor.
With your current project highlighted in the Project Explorer window,
Insert/Module and paste the above into the window that opens.
To use the routine, enter a formula of the type:
=GetValue(A1)
where your mixed string is stored in A1.
--ron