Extract Latest Date from wall of text

lordfa9

New Member
Joined
Mar 30, 2014
Messages
4
Lets say i have a wall of text that looks like this, all of it in 1 cell

Code:
XXXXXXX ABC 22/04/14, AAAAAAAAAAAAA ABC 17/04/14, FFFFFFF ABC 01/04/14, TGHYTG ABC 22/04/14, HFFA AGF 02/04/14 & 02/05/14.

What formula do I use to extract the latest date from this string? In this example, the ideal result will be 02/05/2014

Some considerations:

  • the wall of text can be very very long
  • the desired output date can be anywhere in the string, it could be at the start one day and at the very end the next, it can be hidden behind an & or maybe not.
 

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.
Give this array-entered** formula a try...

=MAX(IF(ISNUMBER(--MID(A1,ROW(INDIRECT("1:"&LEN(A1)-7)),8)),--MID(A1,ROW(INDIRECT("1:"&LEN(A1)-7)),8)))

**Commit this formula using CTRL+SHIFT+ENTER and not just Enter by itself.
 
Upvote 0
Give this array-entered** formula a try...

=MAX(IF(ISNUMBER(--MID(A1,ROW(INDIRECT("1:"&LEN(A1)-7)),8)),--MID(A1,ROW(INDIRECT("1:"&LEN(A1)-7)),8)))

**Commit this formula using CTRL+SHIFT+ENTER and not just Enter by itself.

Works for the sample data but returns a "Dates and times that are too negative or too large" message when I use my actual data

is this formula limited to length of text? another thing is that the live data is alphanumeric so

XXXXXXX ABC 22/04/14 could have a mix of letters and numbers in the XXXXXXX portion</pre>
 
Upvote 0
Works for the sample data but returns a "Dates and times that are too negative or too large" message when I use my actual data

is this formula limited to length of text? another thing is that the live data is alphanumeric so

XXXXXXX ABC 22/04/14 could have a mix of letters and numbers in the XXXXXXX portion

No way to know what is wrong unless you show us the text that the formula is failing for... then I can debug it to find out what is wrong.
 
Upvote 0
Well I guess it can't hurt (though I'll take it down once we're done so I appreciate no quoting)

Pulled out a sample from the live data, for testing it's probably fine if we copy paste the string about 15-20 times (thats about the actual length of the data too) and change a few dates here and there
Code:
EP-CON-000107 CON 16/04/14 & 16/04/14, EP-CON-000134 CON 22/04/14, EP-10010074 CAP 22/04/14, EP-L-000004 IND 22/04/14, EP-LOGIC-000003 IC  24/04/14, EP-INTER-000009 IC  24/04/14,
 
Last edited:
Upvote 0
The problem with my formula was your XXXXX's in the original text you posted contained number that were long enough to fool the test I used. Try this array-entered formula instead...

=MAX(IF(ISNUMBER(FIND("/",MID(A1,ROW(INDIRECT("1:"&LEN(A1)-7)),8))+MID(A1,ROW(INDIRECT("1:"&LEN(A1)-7)),8)),--MID(A1,ROW(INDIRECT("1:"&LEN(A1)-7)),8)))
 
Upvote 0
The problem with my formula was your XXXXX's in the original text you posted contained number that were long enough to fool the test I used. Try this array-entered formula instead...

=MAX(IF(ISNUMBER(FIND("/",MID(A1,ROW(INDIRECT("1:"&LEN(A1)-7)),8))+MID(A1,ROW(INDIRECT("1:"&LEN(A1)-7)),8)),--MID(A1,ROW(INDIRECT("1:"&LEN(A1)-7)),8)))

sweet this hits the spot! Thanks!
 
Upvote 0

Forum statistics

Threads
1,215,217
Messages
6,123,673
Members
449,116
Latest member
HypnoFant

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