Not sure if formula or VBA will do this Extracting from Text: F123456, A123456

chipgiii

Board Regular
Joined
Nov 24, 2008
Messages
136
I would like to extract from text. I am trying to find a way to extract from text a string that starts with the letters A, C, or F and is followed by six numbers:

F123456
C654321
A345621

the cells often look like, the below three examples with the text in red what I would like to extract. Not sure if this is doable, but help is welcomed.

CR F319181 FY19-MAY18-51990-L
C 8500078841 FCR F316684 UPH

8500078841FCR A316684 UPHS


 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
Hi,

Based on your given samples, here's one way:


Book1
AB
1CR F319181 FY19-MAY18-51990-LF319181
2C 8500078841 FCR F316684 UPHF316684
38500078841FCR B316684 UPHS
48500078841FCR A316684 UPHSA316684
5C123456 7890123 ABCDEFC123456
6789012 ABCDEF C123456C123456
Sheet483
Cell Formulas
RangeFormula
B1=IFERROR(TRIM(MID(A1,LOOKUP(LEN(A1),SEARCH({" A?????? "," C?????? "," F?????? "}," "&A1&" ")),8)),"")


Formula copied down.
 
Upvote 0
Hi,

Based on your given samples, here's one way:

AB
1CR F319181 FY19-MAY18-51990-LF319181
2C 8500078841 FCR F316684 UPHF316684
38500078841FCR B316684 UPHS
48500078841FCR A316684 UPHSA316684
5C123456 7890123 ABCDEFC123456
6789012 ABCDEF C123456C123456

<colgroup><col style="width: 25pxpx"><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet483

Worksheet Formulas
CellFormula
B1=IFERROR(TRIM(MID(A1,LOOKUP(LEN(A1),SEARCH({" A?????? "," C?????? "," F?????? "}," "&A1&" ")),8)),"")

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>



Formula copied down.

This is working very well, very, very well!

Thanks!!!!
 
Upvote 0

Forum statistics

Threads
1,214,515
Messages
6,119,970
Members
448,933
Latest member
Bluedbw

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