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
 

Some videos you may like

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.

Rick Rothstein

MrExcel MVP
Joined
Apr 18, 2011
Messages
36,701
Office Version
  1. 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
12,594
Office Version
  1. 2007
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,468
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,468
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!
 

Watch MrExcel Video

Forum statistics

Threads
1,123,076
Messages
5,599,627
Members
414,326
Latest member
kfg1287

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