Extract 7 digit number from email subject

ravikabadwal

New Member
Joined
Apr 16, 2014
Messages
10
Hi,

I have imported email subject lines to excel. For ex - FW: 04.15.14 - THE MANHATTAN HOTEL ROTTERDAM BID #: 8399 / GDS CAMPAIGN #: 3672287 SABRE GPS DRU

I need to extract the 7 digit numbers i.e. 3672287 to the next cell from eah subject line. Please note that these numbers are not at the same place.

Any Macro or formulae will be appreciated.

Regards,
Ravi
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
Will the subjects always have 2 # signs and the second always be 3 positions prior to your number?
 
Upvote 0
Not really. Below are some more examples of the subject lines.

FW: ***ISSUE***4.14.14 - LINX HOTEL INTERNATIONAL AIRPORT GALEAO - GJP - #3936905 - SABRE GPS - Expected result 3936905
FW: 04.18.14 CAMINO REAL MEXICO CITY 3612457 GPS- Expected result 3612457
FW: 5.1.14 - HOLIDAY INN ACAPULCO RESORT - #3720111 - DRU- Expected result 3720111

Ravi
 
Upvote 0
Hi Ravi
Welcome to the board

Try:

=MID(A1,MATCH(0,MMULT(-ISERROR(-MID(A1,ROW(INDIRECT("1:"&LEN(A1)-6))+{0,1,2,3,4,5,6},1)),{1;1;1;1;1;1;1}),0),7)
 
Upvote 0
Thanks PGC.. This is great and works fine.
Is it possible to extract the dates also from the examples below as they have different date formats.

FW: 04/15/14** ORIENT EXPRESS HOTELS ITALIA SRL * CAMPAIGN #: 3799264 FLORENCE -GALILEO DRU + SABRE DRU-
FW: ***ISSUE***4.14.14 - LINX HOTEL INTERNATIONAL AIRPORT GALEAO - GJP - #3936905 - SABRE GPS - Expected result 3936905
FW: 04.18.14 CAMINO REAL MEXICO CITY 3612457 GPS- Expected result 3612457
FW: 5.1.14 - HOLIDAY INN ACAPULCO RESORT - #3720111 - DRU- Expected result 3720111
FW: ****ISSUEE****: 4/14/2014 - NORDIC LIGHT HOTEL - CAMPAIGN 3869697 - SABRE, GALILEO TEXT

Thanks once again for your reply.
 
Upvote 0
Hi Ravi

When extracting values you should specify exactly its format.

I see in the examples 4 formats for the dates

m.dd.yyyy
mm.dd.yyyy
m/dd/yyyy
mm/dd/yyyy

Are there any other possible date formats in your data?

Also do you want a date value or the string?
 
Upvote 0
Sorry, for the formats I meant:

m.dd.yy
mm.dd.yy
m/dd/yy
mm/dd/yy

Are there any other possible date formats in your data?

Also do you want a date value or the string?
 
Upvote 0
I would prefer the date value in the format mm.dd.yy

Also, at the moment these are the only possible formats. If any other come up I'll ask you. ;)

 
Upvote 0
I would prefer the date value in the format mm.dd.yy

OK.

Also, at the moment these are the only possible formats.

Well, I read you examples again and found another one:

m.d.yy

So the list of possible formats is (until now)

m.d.yy
m.dd.yy
mm.dd.yy
m/dd/yy
mm/dd/yy

If any other come up I'll ask you.

Sorry, but I may not be available for that. You should spend some time analysing your problem so that you can specify the possible formats.
Then post back with the complete list and I'll try to help.
 
Upvote 0
Hi PGC,

Here is the complete list.

m.d.yy
m.dd.yy
mm.dd.yy
mm.d.yy
mm.d.yyyy
m.d.yyyy
m.dd.yyyy
mm.dd.yyyy
m/dd/yy
mm/dd/yy
m/dd/yyyy
mm/dd/yyyy
m/d/yy
m/d/yyyy
mm/d/yy
mm/d/yyyy
 
Upvote 0

Forum statistics

Threads
1,214,646
Messages
6,120,717
Members
448,985
Latest member
chocbudda

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