+ Reply to Thread
Results 1 to 11 of 11

Overtime hours between two datetimes relative to custom weekly schedule

  1. #1
    Forum Contributor
    Join Date
    08-20-2011
    Location
    Oslo
    MS-Off Ver
    MS 365
    Posts
    245

    Overtime hours between two datetimes relative to custom weekly schedule

    Hi,

    In a production plant there is a custom weekly schedule with defined normal production time. This schedule may be modified from time to time.

    For the time being, the standard schedule is 06:30 to 22:30 Monday to Thursday, 06:30 to 15:30 Friday and no schedule Saturday and Sunday. There may also be specific holidays from time to time that need to be excluded from the schedule.

    Any time worked outside these hours is defined as overtime.

    I need a formula to calculate the overtime that has been spent between a start datetime and an end datetime relative to this weekly schedule.

    Please see attached workbook which gives a few pre-calculated examples.

    Best regards,
    Marbleking
    Attached Files Attached Files

  2. #2
    Forum Contributor
    Join Date
    08-20-2011
    Location
    Oslo
    MS-Off Ver
    MS 365
    Posts
    245

    Re: Overtime hours between two datetimes relative to custom weekly schedule

    Hi,

    I have started using this formula for calculating standard work hours:

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    I can then substract this result from total hours worked and get overtime hours worked. However, I am not able to modify the formula to take into account varying upper and lower working hours throughout a standard week.

    I have updated the workbook and included the formula above and also marked out where the formula yields erroneous results in red (see Table 3).

    It'd be great if someone would be able to modify the formula to take into account that a week may contain varying standard work hours from day to day.

    Regards,
    Marbleking
    Attached Files Attached Files

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

    Re: Overtime hours between two datetimes relative to custom weekly schedule

    Will be back tomorrow for this interesting thread.
    Time to get home now.
    Quang PT

  4. #4
    Forum Contributor
    Join Date
    08-20-2011
    Location
    Oslo
    MS-Off Ver
    MS 365
    Posts
    245

    Re: Overtime hours between two datetimes relative to custom weekly schedule

    Hi,

    I think I have found a solution, please see attached workbook and formulas in H16:H24:

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    I wouldn't be surprised if someone is able to simplify it, though.

    Best regards,
    Marbleking
    Attached Files Attached Files

  5. #5
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Overtime hours between two datetimes relative to custom weekly schedule

    Marbleking, thank you for getting back to us.

    I found something confusing.

    What were we to understand the work start/work end times were for the days between work day start/work day end? Rows 18, 19 & 20 in your last upload were also 'head-scratchers'.


    A
    B
    C
    D
    E
    F
    G
    H
    I
    15
    Start datetime
    Stop datetime
    Total hours worked
    Standard hours worked
    Overtime hours worked
    Total hours worked
    Standard hours worked
    Overtime hours worked
    16
    Tuesday 23/03/2021 05:00
    Thursday 25/03/2021 06:00
    49.0
    32.0
    17.0
    49.0
    32.0
    17.0
    17
    Tuesday 23/03/2021 05:00
    Thursday 25/03/2021 08:00
    51.0
    33.5
    17.5
    51.0
    33.5
    17.5
    18
    Tuesday 23/03/2021 05:00
    Thursday 25/03/2021 23:00
    66.0
    48.0
    18.0
    66.0
    48.0
    18.0
    19
    Monday 22/03/2021 22:00
    Thursday 25/03/2021 23:00
    73.0
    48.5
    24.5
    73.0
    48.5
    24.5
    20
    Thursday 25/03/2021 22:00
    Saturday 27/03/2021 14:30
    40.5
    9.5
    31.0
    40.5
    9.5
    31.0
    21
    Friday 26/03/2021 03:00
    Friday 26/03/2021 16:30
    13.5
    9.0
    4.5
    13.5
    9.0
    4.5
    22
    Friday 26/03/2021 07:00
    Monday 29/03/2021 06:30
    71.5
    8.5
    63.0
    71.5
    8.5
    63.0
    23
    Monday 29/03/2021 07:00
    Wednesday 31/03/2021 16:30
    57.5
    15.5
    42.0
    57.5
    15.5
    42.0
    24
    Monday 29/03/2021 07:00
    Tuesday 30/03/2021 16:30
    33.5
    15.5
    18.0
    33.5
    15.5
    18.0
    Dave

  6. #6
    Forum Contributor
    Join Date
    08-20-2011
    Location
    Oslo
    MS-Off Ver
    MS 365
    Posts
    245

    Re: Overtime hours between two datetimes relative to custom weekly schedule

    Hi Dave,

    Thanks for asking. Each row with start and stop dates/times in the table is entered as an example of a continuous production process/batch that may last several operator shifts, or parts of operator shifts, but which may also need overtime if there are delays. Each row is to be seen separately from the rest of the rows, because these are only examples for calculation purposes. I have entered various times that might serve to highlight calculating difficulties. So this is not a list of serial production for one production line where each start will happen after the stop time of the former row, but rather just a way of testing the formula. Operators may e.g. normally, and most days, be working 06:30 to 14:30 and overlap with the next shift that starts 13:30 and works to 22:30. But the line would run continuously. So the "overtime" I am after is the times the line needs to run outside normal shift hours.

    Regards,
    Marbleking
    Last edited by Marbleking; 03-26-2021 at 03:17 PM.

  7. #7
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Overtime hours between two datetimes relative to custom weekly schedule

    OK and thank you.

    I tried approaching the project with those assumptions and never consistently came up with the results you expected.

    Intriguing and challenging problem. It kept me busy.

  8. #8
    Forum Contributor
    Join Date
    08-20-2011
    Location
    Oslo
    MS-Off Ver
    MS 365
    Posts
    245

    Re: Overtime hours between two datetimes relative to custom weekly schedule

    Good to hear and happy Easter to you! :-)

  9. #9
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Overtime hours between two datetimes relative to custom weekly schedule

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

    Also, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

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

    Re: Overtime hours between two datetimes relative to custom weekly schedule

    Not able to try with Ex365, I am using 2016, but have you tested with data like this:
    Start date/En date fall into weekend/holiday?

  11. #11
    Forum Contributor
    Join Date
    08-20-2011
    Location
    Oslo
    MS-Off Ver
    MS 365
    Posts
    245

    Re: Overtime hours between two datetimes relative to custom weekly schedule

    Hi bebo021999,

    Yes, the solution works for start dates/end dates that fall into weekend/holidays too. I found an error in the last link of the formula which handles holidays, though. I have corrected it in the attached workbook.

    Formula: copy to clipboard
    Please Login or Register  to view this content.



    It would be interesting to see an Excel 2016 solution to this.

    Regards,
    Marbleking
    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. Speading Activity Hours over schedule in weekly increments.
    By Bolesy in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-26-2021, 01:34 AM
  2. [SOLVED] Total number of hours by person from a weekly schedule
    By [email protected] in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-30-2015, 05:18 PM
  3. Creating a Bi-Weekly Work Schedule with Total Hours.
    By DauntlessDS in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-31-2015, 07:53 PM
  4. Weekly schedule to add up hours to be worked
    By Dxysis3 in forum Excel General
    Replies: 0
    Last Post: 03-19-2012, 11:18 PM
  5. Calculating overtime hours on a daily and weekly basis
    By Skwerl in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-05-2011, 09:12 PM
  6. [SOLVED] create a timesheet to add daily and weekly hours and overtime
    By molemo in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 07-26-2006, 03:03 AM
  7. [SOLVED] Does anyone have a weekly schedule that computes total hours work
    By Guillermo in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 04-03-2006, 01:10 AM

Tags for this Thread

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