Forum Discussion

fishfish31's avatar
fishfish31
Copper Contributor
Feb 28, 2020

How to automate a timesheet template?

Hi all!
I’ve got a billing template and would like automate the calculation of hours as much as possible, wondering if anyone can help take a look?

 


The grey area is where should be calculated by formula and it will be calculated based on the hours spent on task A and B within a day.


Total regular hours is 8 hours for a day. After 8 hours, no matter what task I’m performing, all OT hours will fall to that particular task. For example, I worked on Task A from 9 am-12 pm, 1 pm-6 pm, and then had overtime work on Task B from 6-7pm, then my OT hour would fall to Task B (1 Hour), and if I worked on Task A again from 7-8pm, then there would be 1 hour OT for task A as well.


I have got the basic formula of calculating normal hour and OT hour per task, but I cannot figure out how to calculate the total hours based on the timeline of both tasks.
And for Saturday and Sunday, it is by default calculated as overtime hrs but sometimes it may be counted as regular hours if that day is an official working day. I’ve searched online and found out we can add a button (or any other better methods! J) to be clicked on to calculate base on different rate. Wondering if that’s possible to do this on the template (though it’s for the regular/OT hrs)?

Here are the formulae I’ve got in hand, thank you!

Regular hours:
=IF(24*(IF([@[Time In]]>[@[Break Start]],[@[Break Start]]+1-[@[Time In]],[@[Break Start]]-[@[Time In]])+IF([@[Break End]]>[@[Time Out]],[@[Time Out]]+1-[@[Break End]],[@[Time Out]]-[@[Break End]]))>8,8,24*(IF([@[Time In]]>[@[Break Start]],[@[Break Start]]+1-[@[Time In]],[@[Break Start]]-[@[Time In]])+IF([@[Break End]]>[@[Time Out]],[@[Time Out]]+1-[@[Break End]],[@[Time Out]]-[@[Break End]])))


OT hours:
=IF(24*(IF([@[Time In]]>[@[Break Start]],[@[Break Start]]+1-[@[Time In]],[@[Break Start]]-[@[Time In]])+IF([@[Break End]]>[@[Time Out]],[@[Time Out]]+1-[@[Break End]],[@[Time Out]]-[@[Break End]]))>8,24*(IF([@[Time In]]>[@[Break Start]],[@[Break Start]]+1-[@[Time In]],[@[Break Start]]-[@[Time In]])+IF([@[Break End]]>[@[Time Out]],[@[Time Out]]+1-[@[Break End]],[@[Time Out]]-[@[Break End]]))-8,0)

Thank you!!

4 Replies

  • Patrick2788's avatar
    Patrick2788
    Silver Contributor

    fishfish31 

    Have you considered using MS Project?  If you have access to it then it's worth a look.  It has a lot of functionalities you describe here.  In Excel you'd be building the engine, so to speak.  Project does these things out of the box.

    • fishfish31's avatar
      fishfish31
      Copper Contributor

      Patrick2788 Thanks for the reply! No I don't think I have access to MS Project...You've mentioned building the engine so that means we cannot use a complex formula to automatically calculate the hours right?

      • Riny_van_Eekelen's avatar
        Riny_van_Eekelen
        Platinum Contributor

        fishfish31 If you need to do this in Excel, you can achieve what you want with a slightly different set-up of your time card. I demonstrate this in the attached file below yours.

         

        The idea is that you look at In, Start break, End break and Out for each task separately. For instance, on Friday, Task A started 9AM with a break from 12PM until 6PM and then one more hour until 7PM. Task B started 1PM with no breaks to end 6PM. The Over-time formula for weekdays are not straight-forward, though, I believe that they are easier to comprehend than what you described above. 

        The standard week-end formula for over-time is far more easy. I added an entry for Saturday to test it.

         

Resources