Extracting a date in a non standard format

JaneMore

New Member
Joined
Apr 30, 2016
Messages
14
Hello I am trying to extract a date of birth date string held in a cell and put it in a standard US date format in a new cell eg 12/21/1903

The date is being held in a text cell in the following format but is some times surrounded by other data

DOB-12-21-1903 Bill Married Mary on 10-07-1924
DOB 04-25-1911
DOB-02-28-1925 John went to war in 03-07-1939 but did not return till 03-07-1946
DOB 09-12-1928
DOB 09-12-1906 Mary Past away in 1976

Some times the data string can be prefixed with "DOB" or some times its "DOB-" this is how I am able to tell that this is this persons date of birth

I am not sure of the best method to go about trying to extract the date of birth please could someone help me
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
How about
=SUBSTITUTE(TRIM(MID(A2,SEARCH("dob",A2)+4,11)),"-","/")*1
 
Upvote 0
For an entry in cell A1, this formula woudl return that value as Text (12/21/1903).
Code:
=SUBSTITUTE(MID(A1,5,10),"-","/")

If you need it to be a date, surround it with DATEVALUE, i.e.
Code:
=DATEVALUE(SUBSTITUTE(MID(A1,5,10),"-","/"))
then apply your desired custom date format.
 
Upvote 0
If you need it to be a date, surround it with DATEVALUE, i.e.
Code:
=DATEVALUE(SUBSTITUTE(MID(A1,5,10),"-","/"))
I don't know if it is local dependent or not, but DATEVALUE works directly without the SUBSTITUTE function call on my (US locale) system...

=DATEVALUE(MID(A1,5,10))
 
Upvote 0
I don't know if it is local dependent or not, but DATEVALUE works directly without the SUBSTITUTE function call on my (US locale) system...

=DATEVALUE(MID(A1,5,10))
Nice! That's one less step...
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,249
Members
452,623
Latest member
Techenthusiast

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