Extracting dates in any format from text cells while containing other numbers

otown2221

New Member
Joined
Jul 16, 2020
Messages
5
Office Version
  1. 365
  2. 2019
  3. 2016
Platform
  1. Windows
Hello Guys,

Im trying to extract some dates in any format (ex: 20Jun2020, 20Nov19, 1/31/2019, etc.) I managed to extract some by using

=MID(A1,MIN(IFERROR(MIN(FIND({0,1,2,3,4,5,6,7,8,9},A1&"0123456789",1)),LEN(A1)+1)),LOOKUP(1,0*MID(A1,ROW(INDIRECT("1:"&LEN(A1))),1),ROW(INDIRECT("1:"&LEN(A1)))) + 1 - MIN(IFERROR(MIN(FIND({0,1,2,3,4,5,6,7,8,9},A1&"0123456789",1)),LEN(A1)+1)))

However some come out like this (see below) any way to more efficient extract the dates in any format even though other numbers are in the entry? Thank you guys in advance
2/Ref 4/10MAY2018
012 Configuration Form 6/5/2017
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.

Rick Rothstein

MrExcel MVP
Joined
Apr 18, 2011
Messages
37,866
Office Version
  1. 2019
  2. 2010
Platform
  1. Windows
Since we do not know what your text could look like, you are going to have to tell us what your various dates could look like. For example, some people use dashes or dots instead of slashes, but if your data could have dots or dashes between numbers, then we need to know their possible structure so we can decide how to tell them apart from dates using dots or dashes. I'm sure there are other possible delimiters or date orderings, so we need to know what your possible dates could look like.
 

DanteAmor

Well-known Member
Joined
Dec 3, 2018
Messages
14,762
Office Version
  1. 2010
Platform
  1. Windows
Hi and welcome to MrExcel.

2/Ref 4/10MAY2018
012 Configuration Form 6/5/2017

It would only be those 2 "types" of dates or they could be many more. You will have a larger sample of examples.
 

otown2221

New Member
Joined
Jul 16, 2020
Messages
5
Office Version
  1. 365
  2. 2019
  3. 2016
Platform
  1. Windows
Since we do not know what your text could look like, you are going to have to tell us what your various dates could look like. For example, some people use dashes or dots instead of slashes, but if your data could have dots or dashes between numbers, then we need to know their possible structure so we can decide how to tell them apart from dates using dots or dashes. I'm sure there are other possible delimiters or date orderings, so we need to know what your possible dates could look like.

The original text data in which I am extracting has various entries that have slashes/dashes independent of the date within it. As far as possible dates they are in various formats as well such as "MM/DD/YYYY, MM/DD/YY, DD-Mon-YYYY, DD-Mon-YY,"

Example of original text entries
CVV 4.0/ 11Jan2021
CVV 3.0/ 04MAY17
CVV 2.0/ 22Feb2011
BGS-005 v3 SCG 01/20/2020
BGS-007 v2 SCG 05-02-20

I apologize if this is a hodgepodge of mess cause it is :(
 

gaz_chops

Well-known Member
Joined
Apr 29, 2003
Messages
6,485
Platform
  1. MacOS

ADVERTISEMENT

Are they always at the end of the text?
 

otown2221

New Member
Joined
Jul 16, 2020
Messages
5
Office Version
  1. 365
  2. 2019
  3. 2016
Platform
  1. Windows

ADVERTISEMENT

Also I dont need every entry to be perfect just as long as I can extract a majority then I am okay with it!
 

gaz_chops

Well-known Member
Joined
Apr 29, 2003
Messages
6,485
Platform
  1. MacOS
Then something like

=TRIM(RIGHT(SUBSTITUTE(I2," ",REPT(" ",99)),99))
1st col to right

or add in Datevalue
=DATEVALUE(TRIM(RIGHT(SUBSTITUTE(I2," ",REPT(" ",99)),99)))
2nd col to right
Datevalue doesn't like the mm/dd scenario

1594917093968.png
 

otown2221

New Member
Joined
Jul 16, 2020
Messages
5
Office Version
  1. 365
  2. 2019
  3. 2016
Platform
  1. Windows
Then something like

=TRIM(RIGHT(SUBSTITUTE(I2," ",REPT(" ",99)),99))
1st col to right

or add in Datevalue
=DATEVALUE(TRIM(RIGHT(SUBSTITUTE(I2," ",REPT(" ",99)),99)))
2nd col to right
Datevalue doesn't like the mm/dd scenario

View attachment 18374
Thank YOU SO MUCH the first formula you gave me works!

Cheers!
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,163,553
Messages
5,832,436
Members
430,133
Latest member
gerasimos

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
Top