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

#### otown2221

##### New Member
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

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
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.

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.

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

Are they always at the end of the text?

Are they always at the end of the text?

I would say out of around 3000 entries 98% of them are

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

Then something like

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

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

Then something like

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

=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!

You're welcome, thanks for the feedback.

Replies
3
Views
88
Replies
12
Views
559
Replies
10
Views
1K
Replies
9
Views
384
Replies
4
Views
692

1,216,404
Messages
6,130,378
Members
449,578
Latest member
TT123

### 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.

### Which adblocker are you using?

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

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