+ Reply to Thread
Results 1 to 6 of 6

Totalling hours from one day to the next

  1. #1
    Registered User
    Join Date
    09-05-2005
    Location
    Basingstoke, England
    MS-Off Ver
    2003
    Posts
    86

    Totalling hours from one day to the next

    Hello, I have a problem that I have so far failed to find an answer to. My company works 24/7 and with that some people on nights starting prior to midnight and then finishing after. Of course the "regular" formula works well in calculating between 00:00 onwards but I am getting an error when for instance the person starts at 20:00 and finishes at 04:00. I have tried numerous ways but still the error persists, any ideas? Thank you.
    Last edited by Ducatisto; 10-16-2008 at 02:40 AM.

  2. #2
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650
    Hi, If start time in "A1" & Finish Time "B1" then:-
    Please Login or Register  to view this content.
    Might work
    Regards Mick

  3. #3
    Forum Expert
    Join Date
    12-23-2006
    Location
    germany
    MS-Off Ver
    XL2003 / 2007 / 2010
    Posts
    6,326
    Another possibility =(b1-a1+(b1<a1))*24

  4. #4
    Registered User
    Join Date
    09-05-2005
    Location
    Basingstoke, England
    MS-Off Ver
    2003
    Posts
    86
    Thank you Mick, your solution worked for me, that solved it correctly.

  5. #5
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,699
    Quote Originally Posted by MickG View Post
    =IF(A1>B1,24-A1+B1,B1-A1)
    I see this formula posted quite often, unfortunately it doesn't give the correct answer if A1 and B1 contain actual times

    It may appear to....

    If A1 contains 20:30 and B1 04:30 and C1 the above formula and C1 is formatted as h:mm then you'll see 8:00 which is correct......but if you change the cell format to [h]:mm you see that the underlying value is 560:00. This means that if you use C1 in another calculation, to total hours for the week for instance, then the 560:00 figure is used and you get the wrong total

    24 in the formula should be replaced with 1, i.e.

    =IF(A1>B1,1-A1+B1,B1-A1)

    or shorter

    =B1-A1+(A1>B1)

    or

    =MOD(B1-A1,1)

    Note: the original formula works when A1 and B1 show times in decimal format, e.g. if A1 shows 20.5 and B1, 4.5 then the formula gives the correct result in decimal hours, i.e. 8 [all cells formatted as number]
    Last edited by daddylonglegs; 10-16-2008 at 05:11 AM.

  6. #6
    Registered User
    Join Date
    09-05-2005
    Location
    Basingstoke, England
    MS-Off Ver
    2003
    Posts
    86
    Thank you daddylonglegs for that. As I am using the hh:mm format I would not see the obvious error with another format ([h]:mm).

    Much appreciated.

+ 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. Available hours calculation in Utilization!!!
    By nandhamnk in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 05-05-2013, 12:41 AM
  2. Time Sheet - Differential hours?
    By The Chip in forum Excel General
    Replies: 2
    Last Post: 10-01-2008, 05:32 PM
  3. Counting days and hours
    By roddie in forum Excel General
    Replies: 15
    Last Post: 09-11-2008, 05:15 AM
  4. enhanced hours
    By each in forum Excel General
    Replies: 1
    Last Post: 11-04-2006, 07:18 AM
  5. Urgent help reqd. in calculating working hours
    By prabodhkgupta in forum Excel General
    Replies: 0
    Last Post: 10-10-2006, 03:11 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