+ Reply to Thread
Results 1 to 9 of 9

Adding time - days, hours, minutes

Hybrid View

  1. #1
    Registered User
    Join Date
    03-19-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    3

    Adding time - days, hours, minutes

    Hi all,

    I have inherited a spreadsheet where I am looking to add up a column of time. The time is currently in the format XXd XXh XXm.

    Here are a selection of times I have in cells [I3] to [I8]:

    [I3] = 34d 20h 40m
    [I4] = 02d 21h 17m
    [I5] = 41d 17h 04m
    [I6] = 05d 21h 57m
    [I7] = 13d 09h 10m
    [I8] = 02d 14h 01m

    I would like [I9] to display the total time which should be 101d 08h 09m.

    I have looked around the internet and tried different formulas but the final SUM always seems to be wrong. One that nearly got it right was http://stackoverflow.com/questions/1...alue-example-1 . This was out by an hour but looking at the formula I couldn't work out why.

    I only use excel occasionally and have inherited this worksheet which is a little over my head. Hopefully someone has a better way of doing this or has a magical formula which makes it all work!

    Thanks in advance,

    Shaun
    Last edited by kryptix; 03-19-2013 at 06:40 AM. Reason: Extra Info

  2. #2
    Forum Expert Ace_XL's Avatar
    Join Date
    06-04-2012
    Location
    UAE
    MS-Off Ver
    2016
    Posts
    6,074

    Re: Adding time - days, hours, minutes

    Try this array formula

    =INT(SUM(LEFT(I3:I8,2)*24*60,MID(I3:I8,5,2)*60,MID(I3:I8,9,2)*1)/24/60)&"d "&INT(MOD(SUM(LEFT(I3:I8,2)*24*60,MID(I3:I8,5,2)*60,MID(I3:I8,9,2)*1),24*60)/60)&"h "&MOD(SUM(LEFT(I3:I8,2)*24*60,MID(I3:I8,5,2)*60,MID(I3:I8,9,2)*1),60)&"m"
    Confirm with Ctrl+Shift+Enter and not just Enter
    Life's a spreadsheet, Excel!
    Say thanks, Click *

  3. #3
    Registered User
    Join Date
    03-19-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    3

    Re: Adding time - days, hours, minutes

    Hi Ace,

    Firstly thanks for the quick reply and that works perfectly! One small thing - It displays as 101d 8h 9m instead of 101d 08h 09m - is there a way to add the "0's" - if not it's fine it's just my OCD!

    Thanks again,

    Shaun

  4. #4
    Registered User
    Join Date
    03-19-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    3

    Re: Adding time - days, hours, minutes

    Accidental multi-post

  5. #5
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,788

    Re: Adding time - days, hours, minutes

    I am confused how Ace_XL is getting 108 since mine is getting 104h

    Formula: copy to clipboard
    =SUMPRODUCT(1*LEFT(I3:I8,2))+INT((SUMPRODUCT(1*MID(I3:I8,5,2))+INT(SUMPRODUCT(1*MID(I3:I8,5,2))/60))/24)&"d"&TEXT(INT((SUMPRODUCT(1*MID(I3:I8,5,2))+(SUMPRODUCT(1*MID(I3:I8,9,2))/60))/24)," 00")&"h"&TEXT(MOD(SUMPRODUCT(1*MID(I3:I8,9,2)),60)," 00")&"m"


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  6. #6
    Forum Expert Ace_XL's Avatar
    Join Date
    06-04-2012
    Location
    UAE
    MS-Off Ver
    2016
    Posts
    6,074

    Re: Adding time - days, hours, minutes

    If you insist..

    =INT(SUM(LEFT(I3:I8,2)*24*60,MID(I3:I8,5,2)*60,MID(I3:I8,9,2)*1)/24/60)&"d "&TEXT(INT(MOD(SUM(LEFT(I3:I8,2)*24*60,MID(I3:I8,5,2)*60,MID(I3:I8,9,2)*1),24*60)/60),"00")&"h "&TEXT(MOD(SUM(LEFT(I3:I8,2)*24*60,MID(I3:I8,5,2)*60,MID(I3:I8,9,2)*1),60),"00")&"m"
    Remember to Ctrl+Shift+Enter

  7. #7
    Registered User
    Join Date
    03-19-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    3

    Re: Adding time - days, hours, minutes

    Thanks Ace that's perfect!

  8. #8
    Forum Expert Ace_XL's Avatar
    Join Date
    06-04-2012
    Location
    UAE
    MS-Off Ver
    2016
    Posts
    6,074

    Re: Adding time - days, hours, minutes

    Edited (and corrected) version of Sixth Sense's non-array formula

    =SUMPRODUCT(1*LEFT(I3:I8,2))+INT((SUMPRODUCT(1*MID(I3:I8,5,2))+INT(SUMPRODUCT(1*MID(I3:I8,5,2))/60))/24)&"d"&TEXT(MOD(INT((SUMPRODUCT(1*MID(I3:I8,5,2))+SUMPRODUCT(1*MID(I3:I8,9,2))/60)),24)," 00")&"h"&TEXT(MOD(SUMPRODUCT(1*MID(I3:I8,9,2)),60)," 00")&"m"

  9. #9
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,788

    Re: Adding time - days, hours, minutes

    Thanks for the correction Ace_XL

+ 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