Closed Thread
Results 1 to 5 of 5

Subtract dates-show how many months & days

  1. #1
    Registered User
    Join Date
    07-18-2007
    Location
    Joliet, Illinois
    Posts
    30

    Subtract dates-show how many months & days

    I am trying to come up with a formula that will subtract hire date from termination date and show the answer as "2 years, 5 months".

    I should think this is possible but can't come up with the right formula combination. I can subtract hire from term date easily enough - from there I am lost.

    Thanks in advance for all of you wonderful people with the knowledge to help us less fortunate....

  2. #2
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,885
    Do you want it to show down to the days level? Your example shows years/months, not months/days.

  3. #3
    Registered User
    Join Date
    07-18-2007
    Location
    Joliet, Illinois
    Posts
    30
    It would be nice to see years, months, days but I would settle for just years, months.

    Is there much of a difference in the formula?

  4. #4
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,885
    This should get you pretty close to what you need:
    =IF(DATEDIF(A2,A3,"y")>=1,DATEDIF(A2,A3,"y")&" years, "&DATEDIF(A2,A3,"ym")&" months, "&DATEDIF(A2,A3,"md")&" days",IF(DATEDIF(A2,A3,"ym")>=1,DATEDIF(A2,A3,"ym")&" months, "&DATEDIF(A2,A3,"md")&" days",DATEDIF(A2,A3,"md")&" days"))

    This could be shorter, but I've added in checks to see if it's less than a year or less than a month, and if so it will leave off the "0 years.." or "0 years, 0 months.." parts.

    Replace A2 and A3 with your start (A2) and end (A3) dates.

  5. #5
    Registered User
    Join Date
    07-18-2007
    Location
    Joliet, Illinois
    Posts
    30
    Absolutely fantastic!

    Exactly what I wanted to happen - you are fabulous....

    Thank you very much!

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