| 7:30 |
15:45 |
1:00 |
1:30 |
| 7:45 |
16:00 |
1:00 |
1:00 |
| 8:00 |
16:15 |
1:00 |
1:30 |
| 8:15 |
16:30 |
1:00 |
1:30 |
| 8:30 |
16:45 |
1:00 |
1:00 |
I have a specific problem with calculating time in Excel. Idea is easy: working hours and overtime. I have four colums: arriving, leaving, overtime ja cashing. Arriving and Overtime are hh:mm based, like 07:00 and 16:00. Overtime is leaving minus arriving minus daily worktime that is 7h 15min. Cashing is that when the overtime is 1h to 1h 59min, it is multiplied with 1,5. And if 2 hours or more, it's multiplied with 2. Everything under 1 hour goes to overtime bank.
It works perfectly. On every other arriving hour except 07:45 and 08:30. And it's driving me nuts. Everything is copied so the formulas and cell editing are all the same. 1 hour overtime, which is multiplied by 1,5, gives 1:30. As it should. But when I input arriving time at 07:45 and leaving 16:00, it shows overtime 1 hour, but doesn't multiply it. Same with 08:30 to 16:45. Every other variation works, ex. 08:15 to 16:30. 1 hour overtime, gives 1:30.
On overtime the formula is =IF(C4="","",(C4-B4)-TIME(7,15,0))
On caching the formula is a hellish thing: = IF(D4<0,IF(D4=TIME(0,0,0),IF(C4="","",IF(AND(D4<TIME(2,0,0),D4>=TIME(1,0,0)),D4*1,5,IF(D4>TIME(2,0,0),(TIME(3,0,0)+((D4-TIME(2,0,0))*2)),""))),D4),IF(D4=TIME(0,0,0),D4,IF(C4="","",IF(AND(D4<TIME(2,0,0),D4>=TIME(1,0,0)),D4*1,5,IF(D4>TIME(2,0,0),(TIME(3,0,0)+((D4-TIME(2,0,0))*2)),D4)))))
There has to be an easier way of doing this, but for now it works on every other part than that 07:45 and 08:30 arriving. I've checked all settings, formatting, cells and even went thru with it with ChatGPT, which actually gave good ideas to simplifying the code.