Extract date from text

Neokey

New Member
Joined
Oct 14, 2005
Messages
10
Hi All,

I wonder if anyone can help?

I have a workbook that contains a date in a text cell and I would like to create a function to extract the date, I would also like to format the cell as a date after the information has been extracted.

Oh and I forgot to mention that not all the cells have text so would it be possible to ignore the cell that are blank?

Below is an example of the text in the cell with the date: -


Payment# 328604 on 09/14/18 for GBP 231.00


Thank you for looking and I would be really grateful for any help.



<colgroup><col width="387"></colgroup><tbody>
</tbody>
 
I tried the formula and even though I formatted the resulting cells as a date I am still missing some dates.
I'm not sure why, but all the tests are only returning the date from certain cells?

The dates in the report are mm/dd/yy, but I suspect that you use dd/mm/yy

Try my formula in Post # 5 again, but format result column Custom dd/mm/yyyy

As Fluff suggested, may be your region uses dd/mm/yyyy format by default?
If this is true, the dates that are Not being shown, for example, the Last entry in your sample in Post # 4, 07/13/18, is being interpreted as Month of 13, 7th, 2018 , which, obviously does not exist.
 
Upvote 0

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
You can add 2000 to the year like
=IFERROR(DATE(MID(A2,FIND("/",A2)+4,2)+2000,MID(A2,FIND("/",A2)-2,2),MID(A2,FIND("/",A2)+1,2)),"")
@jtakw
Your formula is still giving the wrong result for me. As shown by the OP in Post#4
 
Last edited:
Upvote 0
@jtakw
Your formula is still giving the wrong result for me. As shown by the OP in Post#4

If you're referring to my formula in Post # 5, it works for me...
I'm still thinking it's a regional setting issue for OP...


Book1
AB
1PaymentFormatted as Date
2Payment# 318310 on 07/13/18 for GBP 5.187/13/2018
3Payment# 322013 on 08/03/18 for GBP 45.508/3/2018
4Payment# 318310 on 07/13/18 for GBP 83.327/13/2018
5Payment# 318310 on 07/13/18 for GBP 58.817/13/2018
6Payment# 318310 on 07/13/18 for GBP 71.187/13/2018
7Payment# 318310 on 07/13/18 for GBP 46.877/13/2018
8Payment# 318310 on 07/13/18 for GBP 34.067/13/2018
9Payment# 318310 on 07/13/18 for GBP 20.827/13/2018
10Payment# 318310 on 07/13/18 for GBP 36.847/13/2018
11Payment# 318310 on 07/13/18 for GBP 85.497/13/2018
12Payment# 318310 on 07/13/18 for GBP 36.847/13/2018
13Payment# 318310 on 07/13/18 for GBP 25.347/13/2018
14Payment# 322013 on 08/03/18 for GBP 49.968/3/2018
15Payment# 318310 on 07/13/18 for GBP 88.557/13/2018
16Payment# 318310 on 07/13/18 for GBP 34.817/13/2018
17Payment# 318310 on 07/13/18 for GBP 11.457/13/2018
18Payment# 318310 on 07/13/18 for GBP 7.567/13/2018
19Payment# 318310 on 07/13/18 for GBP 98.507/13/2018
20Payment# 316703 on 07/06/18 for GBP 226.847/6/2018
21Payment# 316703 on 07/06/18 for GBP 151.577/6/2018
22Payment# 316703 on 07/06/18 for GBP 109.527/6/2018
23Payment# 316703 on 07/06/18 for GBP 117.527/6/2018
24Payment# 316703 on 07/06/18 for GBP 117.527/6/2018
25Payment# 316703 on 07/06/18 for GBP 46.877/6/2018
26Payment# 316703 on 07/06/18 for GBP 151.577/6/2018
27Payment# 316703 on 07/06/18 for GBP 46.877/6/2018
28Payment# 316703 on 07/06/18 for GBP 95.987/6/2018
29Payment# 316703 on 07/06/18 for GBP 199.317/6/2018
30Payment# 316703 on 07/06/18 for GBP 46.877/6/2018
31Payment# 316703 on 07/06/18 for GBP 2.787/6/2018
32Payment# 316703 on 07/06/18 for GBP 6.467/6/2018
33Payment# 318310 on 07/13/18 for GBP 124.207/13/2018
Sheet330
Cell Formulas
RangeFormula
B2=IFERROR(MID(A2,SEARCH("??/??/??",A2),8)+0,"")


Formula copied down.
 
Upvote 0
If you're referring to my formula in Post # 5, it works for me...
I'm still thinking it's a regional setting issue for OP...
I was referring to that formula & I'd agree that it's a regional setting as I get the same result as the OP showed in post#4.

Hence why i said
The dates in the report are mm/dd/yy, but I suspect that you use dd/mm/yy
 
Upvote 0
Try my formula in Post # 5 again, but format result column Custom dd/mm/yyyy

As Fluff suggested, may be your region uses dd/mm/yyyy format by default?
If this is true, the dates that are Not being shown, for example, the Last entry in your sample in Post # 4, 07/13/18, is being interpreted as Month of 13, 7th, 2018[/B] , which, obviously does not exist.


Agree, see quote of Post # 11.
 
Upvote 0
=IFERROR(DATE(20&MID(A2,FIND("/",A2)+4,2),MID(A2,FIND("/",A2)-2,2),MID(A2,FIND("/",A2)+1,2)),"")

Can't find a date that isn't there, this assumes 2000 by putting 20 in front of the year

This is the formula that worked without any changes to region.
 
Upvote 0

Forum statistics

Threads
1,214,979
Messages
6,122,551
Members
449,088
Latest member
davidcom

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