+ Reply to Thread
Results 1 to 1 of 1

workday formula containing different working hours and breaks during week

  1. #1
    Registered User
    Join Date
    12-13-2013
    Location
    Denmark
    MS-Off Ver
    Excel 365
    Posts
    17

    workday formula containing different working hours and breaks during week

    Hello Everyone

    I'm creating a production plan to calculate tarket date/time for my modules based on the rumtime.
    I'm using the formula provided by daddylonglegs in this thread:
    excelforum.com/excel-formulas-and-functions/979700-calculating-target-date-time-based-on-start-date-and-hours-excel-2007-a

    This works fine if working hours are the same every day, and there are no breaks.

    Problem 1
    I have a shorter working day on fridays.
    I'm trying to use an "if" formula to work around this, but end up with a time difference on fridays. The time difference (03:25) is the same as the difference between "end work" for the different days.
    I tried just adding the time difference as you can see in the attached workbook, but that didn't work in every case.

    =IF(TEXT(WORKDAY(A2,CEILING((B2/24+MOD(A2,1)-E$2)/(F$2-E$2),1)-1,D$2:D$10)+MOD(A2,1)+B2/24-CEILING(MOD(A2,1)+B2/24-E$2,F$2-E$2)+F$2-E$2,"dddd")<>"friday",WORKDAY(A2,CEILING((B2/24+MOD(A2,1)-E$2)/(F$2-E$2),1)-1,D$2:D$10)+MOD(A2,1)+B2/24-CEILING(MOD(A2,1)+B2/24-E$2,F$2-E$2)+F$2-E$2,WORKDAY(A2,CEILING((B2/24+MOD(A2,1)-E$2)/(G$2-E$2),1)-1,D$2:D$10)+MOD(A2,1)+B2/24-CEILING(MOD(A2,1)+B2/24-E$2,G$2-E$2)+G$2-E$2)
    where
    A2 is start date and time
    B2 is total hours to complete the task (format: integer)
    E2 is start work
    F2 is end work on monday-thursday
    G2 is end work on friday
    D2:D10 is holidays

    Problem 2
    My other problem is worktime breaks - morning break and lunch break
    I can easily add both breaks:

    =WORKDAY(A2,CEILING((B2/24+MOD(A2,1)-E$2)/(F$2-E$2),1)-1,D$2:D$10)+MOD(A2,1)+B2/24-CEILING(MOD(A2,1)+B2/24-E$2,F$2-E$2)+F$2-E$2+MAX(0,(MIN($F$2,$F$3)-MAX($E$2,$E$3)))+MAX(0,(MIN($F$2,$F$4)-MAX($E$2,$E$4)))
    where
    A2 is start date and time
    B2 is total hours to complete the task (format: integer)
    E2 is start work
    F2 is end work
    E3 is start 1st break
    F3 is end 1st break
    E4 is start 2nd break
    F4 is end 2nd break
    D2:D10 is holidays

    This works well when there are 2 breaks, but when there is only 1 break I get the end time wrong.
    I need different combinations to be found automatically:
    - One morning break
    - One lunch break
    - One morning break + one lunch break
    - 2 morning breaks (over the weekend)

    And in the end I need to combine it all into one formula (hopefully)

    I've added a workbook with my work so far, and a manually created timetable for 2 weeks, where you can check for the right time stamps.

    Any help on either of my two problems would be appreciated
    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. Workday Function with different Working Hours
    By jannis.wa in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-01-2020, 09:24 PM
  2. [SOLVED] Calculate working hours with many different breaks
    By okela in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 01-19-2020, 05:21 PM
  3. [SOLVED] Kitchen roster: working hours - breaks
    By qkta in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-24-2015, 09:53 AM
  4. [SOLVED] Formula Calculated total work hours - now need to remove breaks and standard hours?
    By smeem in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-10-2014, 12:15 AM
  5. Working Hours in a Working Week Calculation
    By amasson in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 02-25-2014, 11:09 AM
  6. Subtract breaks from working hours
    By Rosco88 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 11-22-2013, 08:29 AM
  7. Working hours in one week depending week no
    By Zsrinker2 in forum Excel General
    Replies: 2
    Last Post: 06-23-2010, 01:28 PM

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