+ Reply to Thread
Results 1 to 7 of 7

Thread: Date problems

  1. #1
    Registered User
    Join Date
    01-21-2012
    Location
    Gloucester
    MS-Off Ver
    Excel 2007
    Posts
    29

    Date problems

    Having a bit of a problem with Excel, I know the dates only work down to 1900, but is there any easy way around it or an add-on to help?

    Using this formula

    =DATEDIF(Date1,Date2,"y") & "y " & DATEDIF(Date1,Date2,"yd") & "d"

    Most of the dates are in the 1900s, but a few are in the 1890s

  2. #2
    Valued Forum Contributor MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Seattle, WA
    MS-Off Ver
    Excel 2010
    Posts
    5,275

    Re: Date problems

    Hi JackHamer and welcome to the forum,

    See if this helps...
    http://www.exceluser.com/explore/earlydates.htm
    Or some add-in formulas at
    http://j-walk.com/ss/excel/files/xdate.htm
    One test is worth a thousand opinions.
    Click the * below to say thanks.

  3. #3
    Registered User
    Join Date
    01-21-2012
    Location
    Gloucester
    MS-Off Ver
    Excel 2007
    Posts
    29

    Re: Date problems

    Thanks, couldn't quite understand how to make the first one work, getting quite close with Xdate

    Using this formula now, slightly off, because of the leap years

    =XDATEYEARDIF(A1,B1) & "y " & ((XDATEDIF(B1,A1)-365*XDATEYEARDIF(A1,B1))-XDATEYEARDIF(A1,B1)/4) & "d"

    Probably as close as I'll get, is there any way to round the last part up, or clean it up so it's more exact, as I'm getting half a day?


    Tweaked it again

    =XDATEYEARDIF(A1,B1) & "y " & ROUND(((XDATEDIF(B1,A1)-365*XDATEYEARDIF(A1,B1))-XDATEYEARDIF(A1,B1)/4), 0) & "d"

    Accurate to within a day, will do for now
    Last edited by JackHammer; 01-21-2012 at 10:31 AM. Reason: Updated formula

  4. #4
    Valued Forum Contributor MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Seattle, WA
    MS-Off Ver
    Excel 2010
    Posts
    5,275

    Re: Date problems

    Hi Jack,

    I don't understand that "half day" problem. I do know that the first leap was legislated - see http://answers.yahoo.com/question/in...6163524AAz0pdX
    Are you running into this problem of 11 missing days?
    One test is worth a thousand opinions.
    Click the * below to say thanks.

  5. #5
    Forum Moderator daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2007
    Posts
    10,053

    Re: Date problems

    Try this for more accuracy

    =XDATEYEARDIF(A1,B1) & "y " & XDATEDIF(B1,xdate(xdateyear(A1)+XDATEYEARDIF(A1,B1),xdatemonth(A1),xdateday(A1))) & "d"

    ....if you want you can probably get the result without using any add-ins, as long as your pre-1900 dates are in a consistent format, what do they look like?
    Last edited by daddylonglegs; 01-21-2012 at 11:01 AM.
    Audere est facere

  6. #6
    Registered User
    Join Date
    01-21-2012
    Location
    Gloucester
    MS-Off Ver
    Excel 2007
    Posts
    29

    Re: Date problems

    Had half a day because I was dividing the years (50 in this case) by 4 to remove the extra days, now I'm rounding it it's fine, as close to perfect as I'll probably ever get

  7. #7
    Registered User
    Join Date
    01-21-2012
    Location
    Gloucester
    MS-Off Ver
    Excel 2007
    Posts
    29

    Re: Date problems

    Quote Originally Posted by daddylonglegs View Post
    Try this for more accuracy

    =XDATEYEARDIF(A1,B1) & "y " & XDATEDIF(B1,xdate(xdateyear(A1)+XDATEYEARDIF(A1,B1),xdatemonth(A1),xdateday(A1))) & "d"

    ....if you want you can probably get the result without using any add-ins, as long as your pre-1900 dates are in a consistent format, what do they look like?
    That's even better, cheers

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.2.0