+ Reply to Thread
Results 1 to 10 of 10

Calculating hours worked overnight, (including 24 hours)

  1. #1
    Registered User
    Join Date
    04-06-2015
    Location
    Essex, England
    MS-Off Ver
    2013
    Posts
    8

    Calculating hours worked overnight, (including 24 hours)

    Hi All,

    Can anyone solve this one for me?

    I am trying to automate the hours worked on a site particularly overnight. For normal duties it is not a problem as I use the formula below, however I have some sites that work 24 hours a day and using this formula it returns zero?

    =D19-C19+(C19>D19)

    Where C19 is the start time and D19 is the finish time.

    I appreciate any help you can provide.

    Thank you,
    Shaun.
    Last edited by Shaun3080; 04-07-2015 at 08:36 AM. Reason: Solved

  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,508

    Re: Calculating hours worked overnight, (including 24 hours)

    Probably need to see a sample workbook with some typical data. Can't see how that would return zero unless the values are equal or zero, or maybe not times.

    Regards, TMS
    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
    Registered User
    Join Date
    04-06-2015
    Location
    Essex, England
    MS-Off Ver
    2013
    Posts
    8

    Re: Calculating hours worked overnight, (including 24 hours)

    Hi Trevor,

    Thank you for responding.
    You are indeed correct in that the values for a 24 hour period are identical. The start time is 07:00 as is the end time so I am looking for a return of 24 rather than zero, if this is possible?

    Thanks,
    Shaun.

  4. #4
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,101

    Re: Calculating hours worked overnight, (including 24 hours)

    Unless you have a DATE/TIME field, excel will assume that 07:00 - 07:00 relates to the same day and will return 0.

    Please attach a sample workbook. Make sure there is enough data to demonstrate your need. Make sure your desired results are shown, mock them up manually if necessary. Remember to remove ALL confidential information first!!!

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU

  5. #5
    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,508

    Re: Calculating hours worked overnight, (including 24 hours)

    I guess that, if a value of zero (0) implies that a) the start and end times are the same and b) that means that it is 24 hours, you could simply put a test in at the beginning of your existing formula:
    Formula: copy to clipboard
    Please Login or Register  to view this content.



    Regards, TMS

  6. #6
    Registered User
    Join Date
    04-06-2015
    Location
    Essex, England
    MS-Off Ver
    2013
    Posts
    8

    Re: Calculating hours worked overnight, (including 24 hours)

    Thank you Glenn and Trevor for your responses.

    Please see a basic table attached.(Hopefully it is there).

    Cheers,
    Shaun.
    Attached Files Attached Files

  7. #7
    Forum Contributor
    Join Date
    01-28-2014
    Location
    Turkey
    MS-Off Ver
    Excel 2013
    Posts
    159

    Re: Calculating hours worked overnight, (including 24 hours)

    I refixed formula
    New formula is below.
    Last edited by Ali Kırksekiz; 04-07-2015 at 07:28 AM.

  8. #8
    Forum Contributor
    Join Date
    01-28-2014
    Location
    Turkey
    MS-Off Ver
    Excel 2013
    Posts
    159

    Re: Calculating hours worked overnight, (including 24 hours)

    For D3 Cell

    Please Login or Register  to view this content.
    drag down

  9. #9
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,481

    Re: Calculating hours worked overnight, (including 24 hours)

    Try:
    =C3-B3+(B3>=C3)
    Quang PT

  10. #10
    Forum Contributor
    Join Date
    01-28-2014
    Location
    Turkey
    MS-Off Ver
    Excel 2013
    Posts
    159

    Re: Calculating hours worked overnight, (including 24 hours)

    Quote Originally Posted by bebo021999 View Post
    Try:
    =C3-B3+(B3>=C3)
    Congratulations. Practice solution.

+ 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. Calculating actual hours worked only in core hours
    By Val C in forum Excel General
    Replies: 3
    Last Post: 02-27-2013, 01:54 AM
  2. Replies: 2
    Last Post: 02-11-2013, 02:26 PM
  3. Replies: 0
    Last Post: 05-14-2012, 05:36 PM
  4. Calculating basic hours worked, between a time range and premium hours worked
    By RoyLittle0 in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 01-07-2012, 06:59 AM
  5. Replies: 0
    Last Post: 01-05-2012, 06:23 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