Parse Numerics

MWilliams

Board Regular
Joined
Jan 29, 2010
Messages
97
I have a column of data where each one has a varying number of letters and numbers.

ACB-LCEG253
ACB-4840
ACB-PDG27451
PDG27499
PDG27422-01
PDG27422-02

etc.

I would like to create another column with a formula that shows just the numeric portion of each cell.

Any suggestions would be appreciated.
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Or, is there a way to sort this original data by the numbers in each string, ignoring the letters in the same string?
 
Upvote 0
This UDF will do that for you if it's any help:

Code:
Function ExtractDigits(s As String) As String
 
    With CreateObject("vbscript.regexp")
        .Pattern = "\D"
        .Global = True
        ExtractDigits = .Replace(s, "")
    End With

End Function

Dom
 
Upvote 0
Hi,

This array might work for you:

=NPV(-0.9,,IF(ISERR(MID(A1,256-COLUMN(A:IV),1)%),"",MID(A1,256-COLUMN(A:IV),1)%))
 
Upvote 0
Thanks for the replies. I was hoping to do this with a formula, but will use a macro if necessary.

Hi,

This array might work for you:

=NPV(-0.9,,IF(ISERR(MID(A1,256-COLUMN(A:IV),1)%),"",MID(A1,256-COLUMN(A:IV),1)%))


I'm not having any luck with this yet. If my data is in A2:A30, what changes are needed to the formula?

Thanks again!
 
Upvote 0
@Sweep - I've not seen NPV used like that before. How does it work?

Dom
 
Upvote 0
Dom,

I'm ashamed to say that I pinched it from somewhere and stored it for later use during some googling.
 
Upvote 0
@Sweep - I've not seen NPV used like that before. How does it work?
I'd love to see an explanation of how/why that works too!
 
Upvote 0

Forum statistics

Threads
1,216,564
Messages
6,131,427
Members
449,652
Latest member
ylsteve

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