+ Reply to Thread
Results 1 to 4 of 4

Calculate Working Hours

  1. #1
    Registered User
    Join Date
    05-01-2008
    Posts
    46

    Calculate Working Hours

    Hi I have the following:
    Task Start Date Task Finish Date Task Duration Working Hours
    07/02/2008 09:00 11/02/2008 14:30 20:30:00 09:00
    17:00


    =IF(NETWORKDAYS(A2,B2)=1,(MIN(EndTime,MOD(B2,1))-MAX(StartTime,MOD(A2,1))),(NETWORKDAYS(A2,B2)-2)*(0.2916666666)+(EndTime-MAX(MOD(A2,1),StartTime))+MIN(MOD(B2,1),EndTime)-StartTime)


    I believe the time shold be 18.5 hours as
    Day 1 =7
    Day 2 =7
    Day 3 = weekend so 0
    Day 4 = weekend so 0
    Day 5 = 5.5 hours (however, 1hour for lunch between 12 and 2) so 4.5 hours.

    How can I correct my formula?

    Thanks

  2. #2
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675
    Assuming you have two additional variables StartLun and EndLun for the start and end of lunch, you could use this formula:

    =(NETWORKDAYS(A2,B2)-1)*(EndTime-StartTime+StartLun-EndLun)+MOD(B2,1)-MOD(A2,1)+((MOD(B2,1)<StartLun)-(MOD(A2,1)<StartLun))*(EndLun-StartLun)

    Assumes that A2 and B2 will always be within the working hours

  3. #3
    Registered User
    Join Date
    05-01-2008
    Posts
    46
    thanks! perfect!

  4. #4
    Registered User
    Join Date
    05-01-2008
    Posts
    46

    Networkdays

    Any Idea how I can (using the above formual as well)calculate the hours only if the start or end time is within a weekend, otherwise exclude it? Then I would also like to be able to put a formula somewhere else that tells me someone has worked a weekend?

    Thanks
    Last edited by Kolacube; 05-14-2008 at 05:21 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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