Variable length numeric extraction from a String

dfuser

New Member
Joined
Feb 12, 2015
Messages
5
I have the following data set that I need to be able to extract the numeric values after a hyphen...

nnnn-IF8 (aa); return 8
nnnn-OF8 (aa); return 8
nnnn-IB16 (aa); return 16
nnnn-OB32 (aa); return 32
nnnn-IR6I (aa); return 6
nnnn-IT6I (aa); return 6

I'm looking for a single formula... any help is greatly appreciated! Thank you.
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Hi.

In all of your examples the desired extraction is followed by a space and then the string "(aa)". I take it this is always the case? If not, can you give more examples, or clarify some other way?

Regards
 
Upvote 0
This formula seems to work...

=LOOKUP(9.9E+307,--LEFT(MID(A1,FIND("-",A1)+MIN(FIND({0,1,2,3,4,5,6,7,8,9},MID(A1,FIND("-",A1),99)&3^45))-1,99),ROW($1:$99)))
 
Upvote 0
Hi.

In all of your examples the desired extraction is followed by a space and then the string "(aa)". I take it this is always the case? If not, can you give more examples, or clarify some other way?

Regards

Yes, this is the format of each string... the nnnn and (aa) portion are inconsequential representing numbers (n) or letters (a) in this case. Thank you for your help!
 
Upvote 0
I can't take the credit for the below, I copied it from post 37 here:http://www.mrexcel.com/forum/excel-...t-only-numbers-text-string-4.html#post4015942

Excel Workbook
AB
1nnnn-IF8 (aa)8
2nnnn-OF8 (aa)8
3nnnn-IB16 (aa)16
4nnnn-OB32 (aa)32
5nnnn-IR6I (aa)6
6nnnn-IT6I (aa)6
Sheet1

Thank you, the only issue with this formula is that the first four (4) characters are numeric as well (I should have been clearer in my original post, sorry about that)... I'd need to find a way to strip those from the result.
 
Upvote 0
This formula seems to work...

=LOOKUP(9.9E+307,--LEFT(MID(A1,FIND("-",A1)+MIN(FIND({0,1,2,3,4,5,6,7,8,9},MID(A1,FIND("-",A1),99)&3^45))-1,99),ROW($1:$99)))

Thank you, I'm not having a lot of luck with this... I'm getting a #N/A result.

Let's try my being more specific and see if it's me (which is likely)...

I have 6 cells AL4...AL9 containing the following...

1756-IF8 (AI)
1756-OF4 (AO)
1756-IB16 (DI)
1756-OB32 (DO)
1756-IR6I (RTD)
1756-IT6I (TC)

I'd like to extract for use in calculations the 8, 4 (typo from the first round), 16, 32, 6, and 6 into AM4....AM9

Does that help to clarify my request? Thank you.
 
Upvote 0

Forum statistics

Threads
1,223,912
Messages
6,175,348
Members
452,638
Latest member
Oluwabukunmi

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