+ Reply to Thread
Results 1 to 8 of 8

Converting to Days, Hours and Minutes

  1. #1
    Registered User
    Join Date
    02-29-2012
    Location
    Edinburgh
    MS-Off Ver
    Excel 2003
    Posts
    5

    Converting to Days, Hours and Minutes

    Hi all

    I am using the following formula to get a time from 1 start date to another (without weekends)

    This is giving me a value in days, but I need this broken down to Days, Hours and Minutes... any help appreciated.

    This is what i am using where : Start date (and Time is ) C3 and end date(and time) is C4.
    =((C4-C3))-SUMPRODUCT(--(WEEKDAY(ROW(INDIRECT(INT(C3)&":"&INT(C4))),2)>5))

    Thanks

    Stacey

  2. #2
    Registered User
    Join Date
    02-29-2012
    Location
    Edinburgh
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: Converting to Days, Hours and Minutes

    Should have mentioned I am using the start and end times in the following format : (13/01/2012 08:43:00)

  3. #3
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Converting to Days, Hours and Minutes

    Hello Stacey,

    If dates are always within Monday to Friday period then try this formula

    =IF(COUNT(C3,C4)=2,NETWORKDAYS(C3,C4)-1-(MOD(C4,1)<MOD(C3,1))&" days "&TEXT(C4-C3,"hh:mm"),"")
    Audere est facere

  4. #4
    Registered User
    Join Date
    02-29-2012
    Location
    Edinburgh
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: Converting to Days, Hours and Minutes

    Thanks daddyLonglegs... works a treat. Just amended to add in seconds and its all good!

    Thanks again

    ( =IF(COUNT(C3,C4)=2,NETWORKDAYS(C3,C4)-1-(MOD(C4,1)<MOD(C3,1))&" days "&TEXT(C4-C3,"hh:mm:ss"),"")

  5. #5
    Registered User
    Join Date
    02-29-2012
    Location
    Edinburgh
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: Converting to Days, Hours and Minutes

    Can I just check what the folmula would be if I wasnt excluding weekends ?

  6. #6
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Converting to Days, Hours and Minutes

    It would simplify to

    =IF(COUNT(C3,C4)=2,INT(C4-C3) &" days "&TEXT(C4-C3,"hh:mm:ss"),"")
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  7. #7
    Registered User
    Join Date
    02-29-2012
    Location
    Edinburgh
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: Converting to Days, Hours and Minutes

    Actually wondering now if my original =((C4-C3)*24)-SUMPRODUCT(--(WEEKDAY(ROW(INDIRECT(INT(C3)&":"&INT(C4))),2)>5))*24
    is a bit overqualified... anyone have a simpler version ?

    Where : Start date (and Time is ) C3 and end date(and time) is C4.

  8. #8
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Converting to Days, Hours and Minutes

    Yes, to get decimal weekday hours between the two times you can use this formula

    =(NETWORKDAYS(C3,C4)-1+MOD(C4,1)-MOD(C3,1))*24

    As with your formula that only works OK if C3 and C4 are always on weekdays

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