New Contributor

# 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

# Re: How to automate a timesheet template?

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.

# Re: How to automate a timesheet template?

@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?

# Re: How to automate a timesheet template?

@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.

# Re: How to automate a timesheet template?

I would take @Riny_van_Eekelen 's example and take it a bit further. I prefer to separate form from function in a case like this.

What I mean by that is make the data collection/input as straight forward as possible by just entering new records on a table. Perform your calculations on the table (function), and present the information however you want (form).

See attached for example of what I mean by that (forgive total lack of formatting finesse). In this case, you would just capture the person, date, task, and time in/out on one record. In the example, the order DOES matter. You can have different people entering their time in between, but the entries for any given person must be chronological. This also does not incorporate any safety for things like timestamps that overlap or are backwards. You would want to use validation or something similar to prevent bad data entry.