+ Reply to Thread
Results 1 to 11 of 11

Thread: Adding Series of Years, Months, & Days

  1. #1
    Registered User
    Join Date
    02-01-2008
    Posts
    6

    Adding Series of Years, Months, & Days

    Hi,

    I'm trying to add different series of years, months, and days together to obtain display a grand total like the one I have in bold below:

    Example:

    1 years, 10 months, 30 days
    +
    10 years, 6 months, 28 days
    +
    1 years, 5 months, 29 days

    Intermediate Total = 12 years, 21 months, 87 days

    Display Goal Total = 14 years, 11 months, 27 days*

    *Note: Assuming 30 days = 1 month

    Any help with this one is most appreciated!
    Jay

  2. #2
    Extremely Helpful member
    Join Date
    12-23-2006
    Location
    Belgium
    MS-Off Ver
    XL2003
    Posts
    6,127
    Welcome to the board,
    how is your data displayed ?
    Quoting entire posts clutters the forum and makes threads hard to read !

    If you are pleased with a member's answer then use the Star icon to rate it

    Click here to see forum rules

  3. #3
    "Eagle Eyed" Forum Moderator oldchippy's Avatar
    Join Date
    02-14-2005
    Location
    Worcester, UK
    MS-Off Ver
    Excel 2007 (Work) and 2007 (Home)
    Posts
    7,130
    With the help of a few helper columns
    Attached Files Attached Files
    oldchippy
    -------------


    If you are happy with the help you have received, please click the blue scales icon in the blue bar of the post.

    Click here >>> Top Excel links for beginners to Experts

    Forum Rules >>>Please don't forget to read these

  4. #4
    Forum Moderator daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2007
    Posts
    10,057
    How did you get your data? If they are the result of calculating the difference between 2 dates then it would be easier to use the base data, e.g.

    If you have start dates in A2:A10 and end dates in B2:B10 and you want the total time in the format given then you can use a formula like

    =DATEDIF(SUM(A2:A10),SUM(B2:B10),"y")&" years, "&DATEDIF(SUM(A2:A10),SUM(B2:B10),"ym")&" months, "&DATEDIF(SUM(A2:A10),SUM(B2:B10),"md")&" days "

  5. #5
    Registered User
    Join Date
    02-01-2008
    Posts
    6
    Hi All,

    I am in the military and have to track periods of service member's periods of service. Some of those members have "broken time", so their dates are not consecutive. Therefore, I need to add up each period of "good time" and then come up with an accurate grand total for the total "good time" they have served, which needs to be broken down by years, months, and days.

    So, I am subtracting two dates to determine each period of good service.

    While it is a bit clunky, I have been using the following formula to calculate and the display the difference between dates:

    =YEAR(C72)-YEAR(B72)-IF(OR(MONTH(C72)<MONTH(B72),AND(MONTH(C72)=MONTH(B72), DAY(C72)<DAY(B72))),1,0)&" years, "&MONTH(C72)-MONTH(B72)+IF(AND(MONTH(C72) <=MONTH(B72),DAY(C72)<DAY(B72)),11,IF(AND(MONTH(C72)<MONTH(B72),DAY(C72) >=DAY(B72)),12,IF(AND(MONTH(C72)>MONTH(B72),DAY(C72)<DAY(B72)),-1)))&" months, "&C72-DATE(YEAR(C72),MONTH(C72)-IF(DAY(C72)<DAY(B72),1,0),DAY(B72))&" days"

    For instance, if I am calculating the "good time" for this date range:

    28-Aug-1981 TO 27-Mar-1992, the formula I have been using yields:

    10 years, 6 months, 28 days

    A member with "broken time" might have 2 or 3 periods of "good time" like the above. So after I obtain each "good time" period, which I display in columns, I then want to add all the periods of "good time" together to obtain a grand total of a member's "good time".

    Haven't had a chance yet to try out the .zip file!

    Thanks,
    Jay

  6. #6
    Extremely Helpful member
    Join Date
    12-23-2006
    Location
    Belgium
    MS-Off Ver
    XL2003
    Posts
    6,127
    To calculate difference between two dates try :
    For the nr of years
    =DATEDIF(A1;A2;"y")
    For the number of months
    DATEDIF(A1;A2;"ym")
    For the nr of days :
    DATEDIF(A1;A2;"md")
    Where A1 is the begin date and A2 the end date ( change the semi-coloms to commas if necessary)
    This is the method found here :http://www.cpearson.com/excel/DateTimeWS.htm
    Last edited by arthurbr; 02-01-2008 at 09:42 AM.
    Quoting entire posts clutters the forum and makes threads hard to read !

    If you are pleased with a member's answer then use the Star icon to rate it

    Click here to see forum rules

  7. #7
    Forum Moderator daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2007
    Posts
    10,057
    Trying to add text strings like "2 years, 3 months, 4 days" is unnecessarily complicated. Try using your base dates to calculate the total period as per my suggestion above.

  8. #8
    Registered User
    Join Date
    02-01-2008
    Posts
    6
    Thank you for your help fellas!

    I just had surgery, so will give your suggestions a go once I am feeling better and my mind is more clear!

    Again, thank you and my apologies for not answering a bit quicker--I'll try all your suggestions in a couple of days and let you know I how I do.

    With best wishes,
    Jay

  9. #9
    Registered User
    Join Date
    02-01-2008
    Posts
    6
    Daddylonglegs,

    I just gave your solution a run and it worked like a champ! Many thanks for your help.

    Likewise, thanks to everyone else who also lent a hand (formula)!

    Jay

  10. #10
    Registered User
    Join Date
    12-17-2011
    Location
    Baguio City, Philippines
    MS-Off Ver
    Excel 2007
    Posts
    1

    Re: Adding Series of Years, Months, & Days

    Quote Originally Posted by daddylonglegs View Post
    Trying to add text strings like "2 years, 3 months, 4 days" is unnecessarily complicated. Try using your base dates to calculate the total period as per my suggestion above.
    Hello!
    I know this post has been made years ago but i still hope for a reply. I tried your formula on a data which has two date ranges and it worked. Now i do not know how to do it with a data that has three or more date ranges. I tried adding another SUM command for each of the year, months and days (ex.=DATEDIF(Sum(A2,A4),SUM(B2,B4),SUM(C2,C4),"y")&"years",...) but Excel returns an error message about the formula being too long or there are too many entries.
    Hope you could help me.
    Thanks,
    Eds

  11. #11
    Forum Guru
    Join Date
    10-28-2008
    Location
    Not here anymore
    MS-Off Ver
    irrelevant
    Posts
    10,151

    Re: Adding Series of Years, Months, & Days

    Welcome to the Forum, unfortunately:

    Your post does not comply with Rule 2 of our Forum RULES. Don't post a question in the thread of another member -- start your own thread. If you feel it's particularly relevant, provide a link to the other thread.

+ 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