date conversion formula help

bhmcpfs

Board Regular
Joined
Apr 1, 2002
Messages
106
Attemptin to convert dates out of a large file in the format:

50610
52210
52810

To a recognizable date
5/6/2010
5/22/2010
5/28/2010

Here's my formula, so far:

=IF(D2>0,DATE(MOD(D2,100),TRUNC(D2/10000),TRUNC(MOD(D2,10000)/100))," ")

Data is in column D.

This works, kinda. Worked on dates prior to 1999 (95% of the dates). 2000 forward the formula fails, making 50610 5/6/1910 instead of 5/6/2010.

Have tried numerous variations with no luck so far... Any help/guideance would be greatly appreciated. Thanks in advance.

Mac
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
Attemptin to convert dates out of a large file in the format:

50610
52210
52810

To a recognizable date
5/6/2010
5/22/2010
5/28/2010

Here's my formula, so far:

=IF(D2>0,DATE(MOD(D2,100),TRUNC(D2/10000),TRUNC(MOD(D2,10000)/100))," ")

Data is in column D.

This works, kinda. Worked on dates prior to 1999 (95% of the dates). 2000 forward the formula fails, making 50610 5/6/1910 instead of 5/6/2010.

Have tried numerous variations with no luck so far... Any help/guideance would be greatly appreciated. Thanks in advance.

Mac
This worked for me...

Book1
AB
2506105/6/2010
3522105/22/2010
4528105/28/2010
5101921/1/1992
612220012/22/2000
711058811/5/1988
Sheet1

This formula entered in B2 and copied down:

=--TEXT(A2,"0-00-00")

Format as Date
 
Upvote 0
How about a non formula approach.
Provided the dates are consistent, and the DAY is always in 2 digit format 06 or 28 etc..

Highlight the column of dates
Data - Text To Columns
Delminated - Next
Uncheck all delimiters - Next
Choose Date - MDY
Finish

Hope that helps.
 
Upvote 0
You're awesome! Works like a charm.

And WAY clearer than my DATE/MOD/TRUNC/TRUNC/MOD beast.

Thanks a bunch!
 
Upvote 0
jonmo - Biff beat you to it, but I'd think your solution would work jus about as easily. To be honest, I wasn't thinking text-to-columns at all. Thanks also.
 
Upvote 0
jonmo - Biff beat you to it, but I'd think your solution would work jus about as easily. To be honest, I wasn't thinking text-to-columns at all. Thanks also.
I didn't think of that either!

Good thinking by jonmo.
 
Upvote 0

Forum statistics

Threads
1,224,584
Messages
6,179,687
Members
452,938
Latest member
babeneker

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