+ Reply to Thread
Results 1 to 10 of 10

Excel Formula that calculates hours worked between a set time

  1. #1
    Registered User
    Join Date
    12-23-2014
    Location
    Ontario, Canada
    MS-Off Ver
    2007
    Posts
    9

    Excel Formula that calculates hours worked between a set time

    Hey Everyone,

    I need to figure out a formula that calculates the total hours worked between 9pm and 7am in 1 formula.

    A - Date
    B - Start Time - 24 hour Time
    C - End Time - 24 hour Time
    D - Time worked between 9pm and 7am

    Any insight on this matter would be appreciated.

    Regards,

  2. #2
    Valued Forum Contributor
    Join Date
    09-17-2012
    Location
    Johannesburg, South Africa
    MS-Off Ver
    Excel 2007
    Posts
    454

    Re: Excel Formula that calculates hours worked between a set time

    Try this:
    shift_hours2_cy.JPG

    Cell C7:
    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    08-07-2015
    Location
    AB, Canada
    MS-Off Ver
    Excel 2013 x64
    Posts
    132

    Re: Excel Formula that calculates hours worked between a set time

    The following formula will show you how much time between your start and end time was between 9PM and 7AM.

    Please Login or Register  to view this content.
    It's not super elegant, but it does the trick. Hope that helps!
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    12-23-2014
    Location
    Ontario, Canada
    MS-Off Ver
    2007
    Posts
    9

    Re: Excel Formula that calculates hours worked between a set time

    Quote Originally Posted by cyiangou View Post
    Try this:
    Attachment 415343

    Cell C7:
    Please Login or Register  to view this content.
    Thanks, this would be great as long as I didn't need to have the values 21:00 and 07:00 showing in the sheet. These values would need to be integrated into the formula.

  5. #5
    Registered User
    Join Date
    12-23-2014
    Location
    Ontario, Canada
    MS-Off Ver
    2007
    Posts
    9

    Re: Excel Formula that calculates hours worked between a set time

    Quote Originally Posted by ThirdFret View Post
    The following formula will show you how much time between your start and end time was between 9PM and 7AM.

    Please Login or Register  to view this content.
    It's not super elegant, but it does the trick. Hope that helps!
    This was great. Only issue I found is it did not calculate properly if the time was 6:00pm to 4:00am. It would only calculate the time after midnight that as 4 hours instead of the 7 hours it should have been. Any ideas on how to fix it to do that calculation correctly?

    Regards
    Last edited by Ixorian; 08-24-2015 at 02:10 PM.

  6. #6
    Forum Contributor
    Join Date
    08-07-2015
    Location
    AB, Canada
    MS-Off Ver
    Excel 2013 x64
    Posts
    132

    Re: Excel Formula that calculates hours worked between a set time

    Oops! Missed that case. The formula below should take into consideration those cases.

    Please Login or Register  to view this content.

    Night hours 2.xlsx

  7. #7
    Valued Forum Contributor
    Join Date
    09-17-2012
    Location
    Johannesburg, South Africa
    MS-Off Ver
    Excel 2007
    Posts
    454

    Re: Excel Formula that calculates hours worked between a set time

    Thanks, this would be great as long as I didn't need to have the values 21:00 and 07:00 showing in the sheet. These values would need to be integrated into the formula.
    Seriously? It was an illustrative example.

  8. #8
    Valued Forum Contributor
    Join Date
    09-17-2012
    Location
    Johannesburg, South Africa
    MS-Off Ver
    Excel 2007
    Posts
    454

    Re: Excel Formula that calculates hours worked between a set time

    More generally:
    Please Login or Register  to view this content.
    I was trying to show you how to do it, not do it for you.

  9. #9
    Registered User
    Join Date
    12-23-2014
    Location
    Ontario, Canada
    MS-Off Ver
    2007
    Posts
    9

    Re: Excel Formula that calculates hours worked between a set time

    Quote Originally Posted by ThirdFret View Post
    Oops! Missed that case. The formula below should take into consideration those cases.

    Please Login or Register  to view this content.

    Attachment 415351
    Awesome!, Thanks a lot. With this as a base I'm going to attempt beautification lol.

    Regards

  10. #10
    Registered User
    Join Date
    12-23-2014
    Location
    Ontario, Canada
    MS-Off Ver
    2007
    Posts
    9

    Re: Excel Formula that calculates hours worked between a set time

    Quote Originally Posted by cyiangou View Post
    More generally:
    Please Login or Register  to view this content.
    I was trying to show you how to do it, not do it for you.
    My Comment was more directed at how I was going to move forward with the code, I appreciated what you gave me. Sorry if you misunderstood my intent.

    Regards,

+ 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] Formula to get the worked hours from time A to time B.
    By ShadowHash in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 11-14-2015, 07:33 AM
  2. Need a formula that calculates vacation hours accrued and used based on hours worked
    By excelnewbie101 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 03-23-2015, 01:06 PM
  3. [SOLVED] Time Sheet that calculates hours worked into one of three shift columns
    By mbocian in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-10-2014, 11:27 AM
  4. Replies: 0
    Last Post: 05-14-2012, 05:36 PM
  5. Replies: 2
    Last Post: 02-24-2012, 12:36 PM
  6. 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
  7. 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