+ Reply to Thread
Results 1 to 6 of 6

Counting total hours worked within m

  1. #1
    Registered User
    Join Date
    08-03-2007
    Posts
    7

    Counting total hours worked within m

    (Title was supposed to say: Counting total hours worked within multiple days)

    Is there anyway to calculate the # of work hours spent on a project given 2
    seperate dates and times, taking into account a work day of 8-5 with an hour lunch?

    For example, if I work 8-5, start a project on 8/3 at 9 and finished it on
    8/7 at 4, the answer would be 22 work hours. Ideally, i'm trying to avoid having a lunch out/lunch in column or having to enter each day into a spreadsheet...

    I'm thinking a datediff equation

    Any ideas would be greatly greatly greatly appreciated.

    Thanks!
    Last edited by umass02; 08-03-2007 at 05:19 PM.

  2. #2
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675
    That can certainly be done, although the lunch hour makes it trickier. What time is lunch?

  3. #3
    Registered User
    Join Date
    08-03-2007
    Posts
    7
    Thanks for the reply. 12-1 would be lunch.

    Got a hunch?

  4. #4
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675
    Assuming you have start time and date in A2 and end time and date in B2 then this formula will give the total hours

    =(NETWORKDAYS(A2,B2)-1)/3+MOD(B2,1)-MOD(A2,1)-((MOD(A2,1)<1/2)-(MOD(B2,1)<1/2))/24

    format result cell as [h]:mm

    Note: NETWORKDAYS function is part of Analysis ToolPak add-in which you need to have installed (Tools > addins > tick "Analysis Toolpak" box)

    I'm assuming that both start and end times will be within working hours, otherwise the formula may give the wrong result.

  5. #5
    Registered User
    Join Date
    08-03-2007
    Posts
    7
    Thanks Daddy! You're a genious!

    I think my only problem now is that if a project goes beyond 24 hours, the total # of work hours will reset back to zero (for obvious reasons in your formula). Is there a way to not have it reset?

    Thanks again

  6. #6
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675
    As I said above - you need to custom format the cell containing the formula as [h]:mm.

    This allows Excel to display "elapsed hours", rather than times, and therefore displays hours over 24 correctly

+ 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