+ Reply to Thread
Results 1 to 10 of 10

Calculating difference between two dates

  1. #1
    Registered User
    Join Date
    09-22-2005
    Posts
    9

    Question Calculating difference between two dates

    I know about the normal formula to calculate the difference between two dates (=(YEAR(A4)-YEAR(A3))*12+MONTH(A4)-MONTH(A3)), however, I'd like a formula that does the same thing but doesn't round up, ie it takes into account the days, and reports back only full months between the two dates.

    For example if a child was born on the 26th May 2009, and today is the 25th May 2010, they are not yet 12 months old (1year), they are 11 months old.

    Does anyone know the correct formula for this?

    Thanks

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Calculating difference between two dates

    Maybe?

    =DATEDIF(A1,TODAY(),"m")

    you can replace TODAY() with a cell containing end date.
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Registered User
    Join Date
    09-22-2005
    Posts
    9

    Re: Calculating difference between two dates

    aha, DATEDIF, that's what I was looking for - thank you!!!

    I'll try and put it into practise but may need to ask a question about that if I dn't get it quite right.

  4. #4
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Calculating difference between two dates

    DATEDIF is an undocumented Excel funtion...

    Have a look here to see more about the function:Datedif()

  5. #5
    Registered User
    Join Date
    09-22-2005
    Posts
    9

    Re: Calculating difference between two dates

    As expected I have a couple of queries on how to apply it.

    I'm calculating what age a parent was, when their child was born, so if the child's age is in A2, and the parent in B2, the formula would be
    =DATEDIF(A2,B2,"m") ? that gives me a #NUM! error
    or
    =DATEDIF(D23,E23,m) ? that gives me a #NAME? error

    I know I'm doing something obvious wrong!

  6. #6
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Calculating difference between two dates

    A2 and B3 have to be dates, not ages.

    This will only give total months between the ages..

    See link above for more

  7. #7
    Registered User
    Join Date
    09-22-2005
    Posts
    9

    Re: Calculating difference between two dates

    Sorry, they are dates - in the format DD/MM/YYYY

  8. #8
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Calculating difference between two dates

    The earlier dates must be in A2 and the later in B2 or re-write as

    =DATEDIF(B2,A2,"m")

  9. #9
    Registered User
    Join Date
    09-22-2005
    Posts
    9

    Re: Calculating difference between two dates

    Aha, knew it would be something silly!

    Thanks a lot.

    I think I've asked this before a few months back but the forum has no record of that thread.

  10. #10
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Calculating difference between two dates

    You are welcome,

    Please mark your thread as Solved.

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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.6.0 RC 1