Actually, time is a number from 0 to 1, where 0 reflects 00:00:00 hours and where 1 reflects 24:00:00. This article describes how to use VBA to calculate a total hours worked, assuming that one can start before midnight and work during different time shifts. I did not consider building a (mega) formula to solve this issue a wise thing to do (but if someone does know or is able to create such a formula, please let me know), so I wrote a VBA procedure. So, if you have to calculate the hours worked when taking these conditions into account, what should you do? Should you work with functions and formulas, or should you write some VBA code? Case 05 – Start after 06:00 and End after 06:00.Case 04 – Start between 00:00 and 06:00 and End after 06:00.Case 03 – Start between 00:00 and 06:00 and End before 06:00. Case 02 – Start before 00:00 and End after 06:00.Case 01 – Start before 00:00 and End before 06:00.For instance because extra fees have to be paid when someone has worked during a night shift.Īssuming that such a night shift takes place from 00:00 to 06:00, you have to deal with five possible scenario’s to calculate the total hours worked. It could also be that a manager wants to see how many hours have been worked during a particular period. You might then have to take into account the fact that you are dealing with two different days. The whole process of time registration becomes more difficult when someone is able to start a work shift before midnight.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |