+ Reply to Thread
Results 1 to 5 of 5

Calculating basic hours worked, between a time range, problems

  1. #1
    Registered User
    Join Date
    01-04-2012
    Location
    Derby, England
    MS-Off Ver
    2010, 2013 2016 Pro
    Posts
    85

    Exclamation Calculating basic hours worked, between a time range, problems

    I am trying to set up a time sheet to work out site basic hours, these are between 07.00 and 18.00, the problem I have is with the summing up, basically my problem is indicated below:-

    If I work 06:00 to 17:00 this should be 10 hours site basic and 1 hour premium hours, but the below sum calculates the site basic hours to 11
    Or if I work 09:00 to 20:00 this should be 9 hours site basic and 2 hour premium hours, but the below sum calculates the site basic hours to 11

    =IF(AND(J36="",M36=""),"",(IF(AND(Table_Data!J1),"",IF(AND(J36<=7,M36>18),(18-7),M36-J36))))

    Site basic hours 07.00-18.00 Monday to Saturday. Premium rates 18.00-07.00 Monday to Saturday
    Attached Files Attached Files
    Last edited by RoyLittle0; 02-11-2012 at 06:42 PM.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Calculating basic hours worked, between a time range, problems

    1) Go into TOOLS > OPTIONS and find the [x] Zero Values settings, uncheck that. This applies to the active sheet only, it's not a global setting.

    2) Now use these formulas:

    W36: =MAX(0,SUM(T36-G36))
    Z36: =MAX(SUM(J36-G36)+(T36-M36),0)
    AC36: =MAX((M36-J36)-MAX("7:00"-J36,0)-MAX(M36-"18:00", 0), 0)
    AF36: =IF(W36=0, 0, MAX("7:00"-J36,0)+MAX(M36-"18:00", 0))

    Copy those down.

    AI42: =IF(W42=0, 0, SUM(T42-G42))
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    01-04-2012
    Location
    Derby, England
    MS-Off Ver
    2010, 2013 2016 Pro
    Posts
    85

    Re: Calculating basic hours worked, between a time range, problems

    Thanks

    Thanks for the help, I also need to incorporate the "(IF(AND(Table_Data!J1)" as this displays the data if the "Tick Box is NOT selected, this is so that I can remove the value from the cell if the day is a Bank Holiday, which makes it Premium time.

    I don't have the Tools > Options, this is why i have used the conditional formatting, and i need to show 00:00 if i work until midnight.

  4. #4
    Registered User
    Join Date
    01-04-2012
    Location
    Derby, England
    MS-Off Ver
    2010, 2013 2016 Pro
    Posts
    85

    Re: Calculating basic hours worked, between a time range, problems

    Oops sorry, i posted this reply twice

  5. #5
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Calculating basic hours worked, between a time range, problems

    Times going past midnight actually is a significant piece of added info.

    For holidays, on your Table_Data sheet add the list of dates that are your holidays into column K, just list them downwards, any dates you want.

    Then use these sets of formulas:

    W36: =MAX(0,SUM(T36-G36)+(G36>T36))
    Z36: =MAX(SUM(J36-G36)+(T36-M36)+(M36>T36),0)
    AC36: =IF(ISNUMBER(MATCH(A36, Table_Data!$K:$K, 0)), 0, MAX((M36-J36)-MAX("7:00"-J36,0)-MAX(M36-"18:00", 0), 0))
    AF36: =W36-Z36-AC36

    Copy those formulas down.

    AI42: =IF(W42=0, 0, SUM(T42-G42))

+ 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