Good morning,
I have spent hours on the site researching how to use formulas to break down shift hours into different billable rates.
I have discovered a fantastic post from Barry Houdini where he shared some formulas and I have adapted as best I can, however I am not confident in my work as I am failing to see how these work:
I have managed to adjust the formula in Col D but I need Col E to calculate 16:00 - 22:00 (it currently does 18:00-23:00) Would anyone please be able to advise me what to change?
Many thanks
Sara
I have spent hours on the site researching how to use formulas to break down shift hours into different billable rates.
I have discovered a fantastic post from Barry Houdini where he shared some formulas and I have adapted as best I can, however I am not confident in my work as I am failing to see how these work:
Test data.xlsx | ||||||||
---|---|---|---|---|---|---|---|---|
A | B | C | D | E | F | |||
2 | start | finish | TOTAL | regular | evening | night | ||
3 | 06:00 | 18:00 | 12:00 | 10:00 | 00:00 | 02:00 | ||
4 | 08:00 | 18:00 | 10:00 | 08:00 | 00:00 | 02:00 | ||
5 | 10:00 | 16:00 | 06:00 | 06:00 | 00:00 | 00:00 | ||
6 | 18:44 | 19:26 | 00:42 | 00:00 | 00:42 | 00:00 | ||
7 | 19:26 | 18:24 | 22:58 | 12:00 | 03:58 | 07:00 | ||
8 | 04:25 | 10:13 | 05:48 | 04:13 | 00:00 | 01:35 | ||
9 | 05:12 | 18:23 | 13:11 | 10:00 | 00:23 | 02:48 | ||
10 | 10:13 | 22:10 | 11:57 | 05:47 | 04:10 | 02:00 | ||
11 | 19:23 | 01:01 | 05:38 | 00:00 | 03:37 | 02:01 | ||
12 | 23:44 | 05:18 | 05:34 | 00:00 | 00:00 | 05:34 | ||
13 | 23:01 | 08:13 | 09:12 | 02:13 | 00:00 | 06:59 | ||
14 | 23:40 | 19:00 | 19:20 | 12:00 | 01:00 | 06:20 | ||
Sheet3 |
Cell Formulas | ||
---|---|---|
Range | Formula | |
C3:C14 | C3 | =IF(B3>A3, B3-A3, 1-A3+B3) |
D3:D14 | D3 | =(A3>B3)*MEDIAN(0,B3-1/4,1/2)+MAX(0,MIN(4/6,B3+(A3>B3))-MAX(1/4,A3)) |
E3:E14 | E3 | =(A3>B3)*MEDIAN(0,B3-3/4,5/24)+MAX(0,MIN(23/24,B3+(A3>B3))-MAX(3/4,A3)) |
F3:F14 | F3 | =B3-A3+(A3>B3)-D3-E3 |
I have managed to adjust the formula in Col D but I need Col E to calculate 16:00 - 22:00 (it currently does 18:00-23:00) Would anyone please be able to advise me what to change?
Many thanks
Sara