Extrcting Numbers from an Alphanumeric String

kramtronix

New Member
Joined
Mar 28, 2006
Messages
47
Hey guys, I've been racking my brain trying to come up with a formula approach to extracting numbers from alphanumber strings
in some cells of my workbook. I've read the following threads, and while they come close, they do not give me exactly what I need.

Here are the threads:

Extracting Multiple Numbers from String


Extract Text or Number from a Column, Help.


The solutions in these actually work, but the problem is that the number I'm dealing with contains a decimal point. Here is an example
of the cell data:

SEWI Beta Assoc 1.2

The formulas in the threads above render "12." What I need is just plain ole "1" as the result, but "1.2" would work if need be.

Any help is greatly appreciated!
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
Hey kramtronix!

Check this UDF, this Extract the Numbers and the point also:

Code:
Function ENAP(Rango As Range) As String

Dim Aux$, i&

For i = 1 To Len(Rango)
    If Mid(Rango, i, 1) Like "#" Or Mid(Rango, i, 1) = "." Then
        Aux = Aux & Mid(Rango, i, 1)
    End If
Next i
ENAP = Aux
End Function

God Bless you!
 
Upvote 0
Perhaps
Code:
Function NumberFromString(aString As String) As Double
    If Val(aString) <> 0 Or (aString = vbNullString) Then
        NumberFromString = Val(aString)
    Else
        NumberFromString = NumberFromString(Mid(aString, 2))
    End If
End Function
 
Upvote 0
Is your number always at the end of the text (set off by a space) as shown in your single example? If so, you could use this formula...

=INT(TRIM(RIGHT(SUBSTITUTE(A1," ",REPT(" ",99)),99)))
 
Upvote 0
Yep, that's it, Rick! You guys always come thru for me on here in my deperate times of need. LOL
 
Upvote 0

Forum statistics

Threads
1,215,425
Messages
6,124,824
Members
449,190
Latest member
rscraig11

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top