+ Reply to Thread
Results 1 to 14 of 14

Calculating basic hours worked, between a time range and premium hours worked

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

    Calculating basic hours worked, between a time range and premium hours worked

    Hi,
    I am trying to calculate the hours worked for a Service Engineers time sheet, my problem is we travel and work on weekends and through the night, so our basic pay is between 07:00 and 18:00, the rest is overtime, unless it is travelling time, see below for the companies explanation on this.

    Site basic hours 07.00-18.00 Monday to Saturday
    Premium rates 18.00-07.00 Monday to Saturday
    Sundays and Bank holidays at basic rate x 180%
    Travel hours Monday to Sunday basic rate x 80%

    I have attached the spreadsheet so it will make more sense to you, I have filled in the Premium hours and Site Basic hours manually, these are the cells i want to automate.

    I will also need to add a tick box for each day to say if it is a bank holiday or not and then include the x180%

    Any thoughts on the matter will be gratefully received, if it can even be done in a formula?

    Roy
    Copy of Instalation Field Service Report.xlsx
    Last edited by RoyLittle0; 01-07-2012 at 08:35 AM. Reason: Solved

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Calculating basic hours worked, between a time range and premium hours worked

    I changed the format in cells J37 and M37 to show the number of hours in number format with 2 decimals. And then i used this formula in cell AF37 to get the premium hours - (7-J37)+(M37-18). Put this formula in cell AC37 to get the site basic hours - =M37-J37-AF37. I changed the format of these 2 cells (AC37 and AF37) to number with 2 decimals too.
    Hope this helps.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  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 and premium hours worked

    Thanks Arlette,
    This has given me a starting point, although this now gives me wrong data in the line above and the ones below, I always see 11 hours in site basic hours even in lines with no figures in J and M, they need to be 9 in AC39 and 7 in AC40, also I am seeing - figures in the Premium hours column, if possible I would like to see nothing (no 0's) if the cell is 0 or less and not to calculate this value, thanks for your help so far.
    Roy

  4. #4
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Calculating basic hours worked, between a time range and premium hours worked

    Ok. I have revised your formulae - use this formula in AC37
    Please Login or Register  to view this content.
    Use this formula in AF37
    Please Login or Register  to view this content.
    Drag down.
    Last edited by arlu1201; 01-06-2012 at 02:01 PM. Reason: Corrected cell references

  5. #5
    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 and premium hours worked

    Thanks Arlette

    That seems to work perfect, I have used conditional format to remove the FALSE.

    To my other question is it possible to add a checkbox or something like that to move the figures from the cells AC (Basic hours) and AF (Premium hours) (AC+AF) and move them to cell AI (Sunday hours) to allow for bank holidays which are charged at Sunday rates?

    If check box selected, leave AC and AF blank and display (AC+AF) in AI ?
    Last edited by RoyLittle0; 01-06-2012 at 10:26 AM.

  6. #6
    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 and premium hours worked

    Or could I use another cell, if I put a "B" or nothing in an adjacent cell could I have a condition that looks for the "B" and will not calculate AC & AF if it finds the "B", then in cell AI, calculate if there is a "B"

    If S36 contains nothing then
    AC Formula =IF(AND(J36="",M36=""),"",IF(AND(J36<=7,M36>18),(18-7),M36-J36))
    AF Formula =IF(AND(J36="",M36=""),"",(IF(AND(J36<7,M36>18),(7-J36)+(M36-18))))

    So if there is a B in S36 then
    AI Formula =(M36-J36)
    AC contains no data
    AF contains no data

    Copy Instalation & Field Service Report.xlsx
    Last edited by RoyLittle0; 01-06-2012 at 01:39 PM.

  7. #7
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Calculating basic hours worked, between a time range and premium hours worked

    Quote Originally Posted by RoyLittle0 View Post
    Thanks Arlette

    That seems to work perfect, I have used conditional format to remove the FALSE.
    I revised the formulae so you shouldnt see the FALSE.

  8. #8
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Calculating basic hours worked, between a time range and premium hours worked

    Quote Originally Posted by RoyLittle0 View Post
    Thanks Arlette

    That seems to work perfect, I have used conditional format to remove the FALSE.
    I revised the formulae so you shouldnt see the FALSE.

    I am working on the rest of your question. Will have something for you by tomorrow.

  9. #9
    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 and premium hours worked

    I have revised the formula but still get a FALSE in the AF column if it is a "0" figure

    I have also added a check box that if checked will give a TRUE in another worksheet indicating it is a Bank Holiday, which i wanted to use to make life easier, so i thought i could do something like =SUMIF(Table_Data!J3,"TRUE",J38-M38) but that doesn't seem to like text

  10. #10
    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 and premium hours worked

    I now have a checkbox that when checked calculates the Bank Holiday hours =IF(Table_Data!J2,M37-J37,"")
    all i need to do is to put "Table_Data!J2" into the above sums so that if they see a 1 in it then don't calculate the sums

    =IF(AND(J36="",M36=""),"",IF(AND(J36<=7,M36>18),(18-7),M36-J36)) insert "Table_Data!J2" so that if they see a 1 in it then don't calculate
    =IF(AND(J36="",M36=""),"",(IF(AND(J36<7,M36>18),(7-J36)+(M36-18)))) insert "Table_Data!J2" so that if they see a 1 in it then don't calculate

    Hope this makes more sense

  11. #11
    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 and premium hours worked

    This seems to work,

    If the tick box is selected "Table_Data!J2" the two formula below are false and no data is displayed, which is correct

    AC =IF(AND(J37="",M37=""),"",(IF(AND(Table_Data!J2),"",IF(AND(J37<=7,M37>18),(18-7),M37-J37)))) Site Basic hours
    AF =IF(AND(J37="",M37=""),"",(IF(AND(Table_Data!J2),"",(IF(AND(J37<7,M37>18),(7-J37)+(M37-18)))))) Premium hours
    and
    AI =IF(Table_Data!J2,M37-J37,"") If the tick box is selected "Table_Data!J2" then the data is added to Bank Holiday hours

    All seems to work.

  12. #12
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Calculating basic hours worked, between a time range and premium hours worked

    Great its working. Also, a small note - if you want to use a tick mark in your file, you can format the cell to Webdings font. If you insert a "a" it changes to a tick mark. This is far easier than inserting a VB Tools checkbox.

  13. #13
    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 and premium hours worked

    Thanks for all your help, Arlette

    I have actually used a "Form Control" check box which only returns "True" or "False" and it seems to work.

    I will add the completed sheet later for anyone who visits this post in the future and mark the thread as "Solved" when I have finished.

  14. #14
    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 and premium hours worked

    This is the form that i have been working on, it is a field service report form and will work out:-

    Travel hours
    Total Hours
    Basic hours (between 07.00 and 18.00)
    Premium hours (between 18.00 and 07.00)
    Sunday and Bank holiday hours

    Hope it proves useful to others

    Field Service Report.xlsx
    Last edited by RoyLittle0; 01-07-2012 at 08:34 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