
Originally Posted by
fleury
Assuming the total number of hours worked is in cell A1, the formula to calculate overtime hours is:
=IF(A1>40,A1-40,0)
(If the total hours worked is greater than 40, then the overtime equals the total hours worked minus 40, otherwise the overtime equals zero)
If you have the total hours spread out over multiple cells, like you describe in the case where you have the employee working in multiple departments, you just need to find the sum of all those hours, and then use the same formula above.
So, if cells A1 and B1 have the hours worked in each department,
=IF(A1+B1>40, A1+B1-40, 0)
In your example, you also implied that you want the formula to tell you what department the overtime was worked in. If that's the case, you would need to be more specific with how you would normally calculate this.
In the example you gave, the employee worked in Dept A for 32 hours, and Dept B for 12 hours. Given only that information, I have no way of telling you which department the overtime was worked in.
--
Marc.
Bookmarks