Extract Variable Length text from a string with varying staring points

funinsum

New Member
Joined
May 14, 2014
Messages
2
I am attempting to extract variable length data representing a notificaiton ID from a text string. The starting point of extract varies as well as the length of data to extract. In the cell A1 examples below, I want to:
extract 1234Z3 from row1,
extract 1234H3ZON from row 2,
extract 1234F1 from row 3,
extract 123F4P from row 4,
extract 1234F5HF from row 5

SAMPLE DATA
ISSUE FORM ABC001, LETTER 1234Z3 GENERATED ON 2014-05-02
ISSUE FORM ABCCOMFPF, LETTER 1234H3ZON GENERATED ON 2014-05-02
ISS Sta 1st Letter , 1234F1, 2014-04-28, $500.00
ISS Pre-Sta Let, 1234F4P, 2014-04-21, $707.00
LETTER FORM 1234F5HF GENERATED ON 2014-04-11


I have tried many variations of MID + FIND but that does not solve for the varying starting extract points and full ID to return.

Any assistance is greatly appreciated!
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
Hi,

All your desired extractions begin with "123" - can you confirm that this is always the case?

And, if so, will there only ever be one occurrence of the substring "123" in a given string? Or, if you can't guarantee that, can you at least confirm that the one you wish to extract will always be the one relating to the first, or second, etc. occurrence of that substring?

Regards
 
Upvote 0
Hi,

All your desired extractions begin with "123" - can you confirm that this is always the case?

And, if so, will there only ever be one occurrence of the substring "123" in a given string? Or, if you can't guarantee that, can you at least confirm that the one you wish to extract will always be the one relating to the first, or second, etc. occurrence of that substring?

Regards


Yes, the desiged extractions will always begin with "123". There will only be one occurance of "123" in any given substring.
 
Upvote 0
Thanks.

=MID(A1,FIND("123",A1),MIN(FIND({" ",","},MID(A1,FIND("123",A1),999)&" ,"))-1)


Regards
 
Upvote 0

Forum statistics

Threads
1,214,922
Messages
6,122,281
Members
449,075
Latest member
staticfluids

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