+ Reply to Thread
Results 1 to 12 of 12

Calculating the total between two times that go over midnight

  1. #1
    Registered User
    Join Date
    07-05-2016
    Location
    UK
    MS-Off Ver
    365
    Posts
    12

    Calculating the total between two times that go over midnight

    Blimey, I'm normally quite on top of this sort of thing and can find out the answer on Google but I'm honestly so stuck on this.

    I'm simply trying to create a spreadsheet to manage my self employed work hours and ensure I am paid appropriately.

    Here is an example:

    05 Tue 20:00:00 08:00:00 ######
    8th Fri 15:30:00 21:00:00 05:30:00
    8th Fri 18:20:00 23:59:00 05:39:00
    9th Sat 00:00:00 23:59:00 23:59:00

    The latest column is the total by taking the finish time from the start time; works on normal times but when a time passes midnight it goes crazy and won't calculate, and I cannot figure out how to make it work so it will always work regardless of the hours I put in without individual adjustments

    Any help appreciated!

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,447

    Re: Calculating the total between two times that go over midnight

    Try:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,936

    Re: Calculating the total between two times that go over midnight

    Perhaps something like this?
    A
    B
    C
    13
    6:00 AM
    12:00 PM
    6:00 AM
    14
    12:00 PM
    6:00 AM
    6:00 PM

    C4=MOD(B4-A4,1)
    Last edited by FDibbins; 07-13-2016 at 10:15 AM.
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,936

    Re: Calculating the total between two times that go over midnight

    duplicate post
    Last edited by FDibbins; 07-13-2016 at 10:15 AM.

  5. #5
    Registered User
    Join Date
    07-05-2016
    Location
    UK
    MS-Off Ver
    365
    Posts
    12

    Re: Calculating the total between two times that go over midnight

    Quote Originally Posted by TMS View Post
    Try:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    That is exactly what I needed, thanks!

    Is this from an old spreadsheet still the best/valid way to convert it in to a decimal/number?

    =INT(D6)*24+HOUR(D6)+ROUND(MINUTE(D6)/60,2)

  6. #6
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,447

    Re: Calculating the total between two times that go over midnight

    I think that
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    will give you decimal hours (even the negative value)

  7. #7
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,936

    Re: Calculating the total between two times that go over midnight

    If you mean , to convert time tio a whole number, why do that? excel has formulas that work well with time.

  8. #8
    Registered User
    Join Date
    07-05-2016
    Location
    UK
    MS-Off Ver
    365
    Posts
    12
    Quote Originally Posted by TMS View Post
    I think that
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    will give you decimal hours (even the negative value)
    =C2*24 works fine (converting an hour display in to decimal) however even though the cell to the left calculated it so any time going over midnight correctly subtracts, the decimal display doesn't agree and goes crazy. Please see attachment.

    Thanks
    Attached Images Attached Images

  9. #9
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,447

    Re: Calculating the total between two times that go over midnight

    Note that I didn't use =E24*24, I used the original values.
    Attached Files Attached Files

  10. #10
    Registered User
    Join Date
    07-05-2016
    Location
    UK
    MS-Off Ver
    365
    Posts
    12

    Re: Calculating the total between two times that go over midnight

    Quote Originally Posted by TMS View Post
    Note that I didn't use =E24*24, I used the original values.
    When a post goes over midnight, =24*(C30>D30)+D30-C30 will return 17:30 to 11:00 as 23.73, but your absolulte returns 6.50#

    Even then the 23.73 is confusing as it shouldn't be .73 anyway...

    Wow this is confusing
    Last edited by groovybluedog; 07-14-2016 at 03:48 PM.

  11. #11
    Forum Expert
    Join Date
    12-11-2011
    Location
    Netherlands
    MS-Off Ver
    office 365
    Posts
    3,293

    Re: Calculating the total between two times that go over midnight

    Change:
    Please Login or Register  to view this content.
    in this:
    Please Login or Register  to view this content.
    And it wil work
    Willem
    English is not my native language sorry for errors
    Please correct me if I'm completely wrong

  12. #12
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,447

    Re: Calculating the total between two times that go over midnight

    See updated example
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Calculating total time worked between a range over midnight.
    By amurr in forum Excel General
    Replies: 10
    Last Post: 03-13-2019, 03:27 AM
  2. Calculating Weekly Total Hours from Daily Times
    By RFernandez in forum Excel General
    Replies: 7
    Last Post: 04-12-2016, 07:13 PM
  3. [SOLVED] Difference between two times - avoiding ###### for times that span midnight
    By Abarency in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 01-07-2015, 01:15 PM
  4. Calculating total time for individual with multiple start/end times
    By schnizz in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-12-2014, 02:45 PM
  5. Calculating hh:mm between two times that span midnight
    By Ymir20000000 in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 05-27-2011, 09:55 AM
  6. 24 hour clock calculating total hours using midnight
    By Wilgoss in forum Excel General
    Replies: 8
    Last Post: 09-06-2010, 11:53 AM
  7. Calculating Total Hours Between Two Times Past 24hr
    By BM4193 in forum Excel General
    Replies: 3
    Last Post: 09-18-2009, 09:21 AM

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