Find specific codes in a large excel in cells with a lot of surrounding text

luuccaapee

New Member
Joined
Apr 18, 2022
Messages
2
Office Version
  1. 365
Platform
  1. Windows
Hello

I have a fairly large excel about 1000 rows. The data source is unfortunately not very clean, meaning it was put in as free text. I need to find very specific 13 digit codes in one of the Columns for example in E: hsjjdalfiw 1234567891234 msbdjwkal. The problem is the number is not always at the same place, or the text around it is not always the same. Sometimes there is not even space around the number for example hfjdl-1234567891234, and of course the codes are always different numbers.

Other examples:

13th street,TX 1349203940123 MR Smith
Mr Johnson, 1349203940123-BE-789, empresa JXD
1349203940123, sdmeSD 6789 sdsd

Is there any formula or any useful trick to extract only these 13 digit codes, so I dont have to do it all manually?

Many thanks!
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
Hi, welcome to the forum!

Here is one possible option you can try:

=TEXTJOIN(",",1,IFERROR(0+MID(SUBSTITUTE(A1," ","|"),SEQUENCE(LEN(A1)-12),13),""))
 
Upvote 0
.. or avoiding the volatile function INDIRECT, you could try ..

22 04 18.xlsm
EF
113th street,TX 1349203940123 MR Smith1349203940123
2Mr Johnson, 1349203940123-BE-789, empresa JXD1349203940123
31349203940123, sdmeSD 6789 sdsd1349203940123
4hsjjdalfiw 1234567891234 msbdjwkal1234567891234
5hfjdl-12345678912341234567891234
Extract 13 digit Num
Cell Formulas
RangeFormula
F1:F5F1=AGGREGATE(14,6,MID(E1,SEQUENCE(LEN(E1)-12),13)+0,1)
 
Upvote 0
.. or avoiding the volatile function INDIRECT, you could try ..

22 04 18.xlsm
EF
113th street,TX 1349203940123 MR Smith1349203940123
2Mr Johnson, 1349203940123-BE-789, empresa JXD1349203940123
31349203940123, sdmeSD 6789 sdsd1349203940123
4hsjjdalfiw 1234567891234 msbdjwkal1234567891234
5hfjdl-12345678912341234567891234
Extract 13 digit Num
Cell Formulas
RangeFormula
F1:F5F1=AGGREGATE(14,6,MID(E1,SEQUENCE(LEN(E1)-12),13)+0,1)
Dear Peter,
many thanks for your answer!
I was mistaken and its 12 numbers and not 13. When I copy your formula, I always get the error message. Should I just subtract 1 number in your formula to change it to 12 numbers?

I have attached a small sample.

Again many thanks for your help and best regards!
 

Attachments

  • Sample.png
    Sample.png
    33.8 KB · Views: 6
Upvote 0
Should I just subtract 1 number in your formula to change it to 12 numbers?
You need to change two numbers in the formula

=AGGREGATE(14,6,MID(A3,SEQUENCE(LEN(A3)-11),12)+0,1)
 
Upvote 0

Forum statistics

Threads
1,214,915
Messages
6,122,212
Members
449,074
Latest member
cancansova

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