#1   Report Post  
Gerrym
 
Posts: n/a
Default Date conversion

I want to convert a number i.e. 041006 into a date, having
formatted the new cell as date: dd/mm/yyy. When I use
the formula =DATE(left(D13,2),MID(D13,3,2),right(D13,2)
I get the date 06/10/1904, when it should be 06/10/2004.
Any suggestions please
  #2   Report Post  
Jason Morin
 
Posts: n/a
Default

Almost. Excel is interpreting "04" as 1904. Try:

=DATE("20"&LEFT(A13,2),MID(A13,3,2),RIGHT(A13,2))

Good for dates 2000 and after.

HTH
Jason
Atlanta, GA

-----Original Message-----
I want to convert a number i.e. 041006 into a date,

having
formatted the new cell as date: dd/mm/yyy. When I use
the formula =DATE(left(D13,2),MID(D13,3,2),right(D13,2)
I get the date 06/10/1904, when it should be 06/10/2004.
Any suggestions please
.

  #3   Report Post  
Harald Staff
 
Posts: n/a
Default

Hi

This is a little confusing; if you have 041006 as a real number, it should
not display the leading 0. amd your left and mid function would err. Give
this a try:

=DATE(1900+MOD(A1,100)+100*(MOD(A1,100)<50),MOD(IN T(A1/100),100),INT(A1/1000
0))

The 50 means
49 = 2049
50 = 1950
change to suit your needs.

HTH. Best wishes Harald


"Gerrym" skrev i melding
...
I want to convert a number i.e. 041006 into a date, having
formatted the new cell as date: dd/mm/yyy. When I use
the formula =DATE(left(D13,2),MID(D13,3,2),right(D13,2)
I get the date 06/10/1904, when it should be 06/10/2004.
Any suggestions please



  #4   Report Post  
Bob Phillips
 
Posts: n/a
Default

You could also include a test for the 1900's. This is a technique we started
using in the 90's as the millennium approached

=DATE(IF(--(LEFT(D13,2))70,19,20)&LEFT(D13,2),MID(D13,3,2),R IGHT(D13,2))

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Jason Morin" wrote in message
...
Almost. Excel is interpreting "04" as 1904. Try:

=DATE("20"&LEFT(A13,2),MID(A13,3,2),RIGHT(A13,2))

Good for dates 2000 and after.

HTH
Jason
Atlanta, GA

-----Original Message-----
I want to convert a number i.e. 041006 into a date,

having
formatted the new cell as date: dd/mm/yyy. When I use
the formula =DATE(left(D13,2),MID(D13,3,2),right(D13,2)
I get the date 06/10/1904, when it should be 06/10/2004.
Any suggestions please
.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Date issue between Windows and Macintosh version dlg1967 Excel Discussion (Misc queries) 4 January 19th 05 04:51 PM
Need help troubleshooting an array formula XLXP on Win2K KR Excel Worksheet Functions 1 December 13th 04 08:41 PM
Addition to Turn cell red if today is greater or equal to date in cell Rich New Users to Excel 2 December 9th 04 03:06 AM
Using formulas to determine date in one cell based on date in anot Gary Excel Worksheet Functions 2 November 22nd 04 09:11 AM
Disable automatic date conversion feature iceseal Excel Worksheet Functions 2 November 12th 04 04:04 AM


All times are GMT +1. The time now is 11:41 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"