Calculating hours in a shift into Reg, PM and Night

saraapple

Board Regular
Joined
Feb 3, 2020
Messages
165
Office Version
  1. 2010
Platform
  1. Windows
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:
Test data.xlsx
ABCDEF
2startfinishTOTALregulareveningnight
306:0018:0012:0010:0000:0002:00
408:0018:0010:0008:0000:0002:00
510:0016:0006:0006:0000:0000:00
618:4419:2600:4200:0000:4200:00
719:2618:2422:5812:0003:5807:00
804:2510:1305:4804:1300:0001:35
905:1218:2313:1110:0000:2302:48
1010:1322:1011:5705:4704:1002:00
1119:2301:0105:3800:0003:3702:01
1223:4405:1805:3400:0000:0005:34
1323:0108:1309:1202:1300:0006:59
1423:4019:0019:2012:0001:0006:20
Sheet3
Cell Formulas
RangeFormula
C3:C14C3=IF(B3>A3, B3-A3, 1-A3+B3)
D3:D14D3=(A3>B3)*MEDIAN(0,B3-1/4,1/2)+MAX(0,MIN(4/6,B3+(A3>B3))-MAX(1/4,A3))
E3:E14E3=(A3>B3)*MEDIAN(0,B3-3/4,5/24)+MAX(0,MIN(23/24,B3+(A3>B3))-MAX(3/4,A3))
F3:F14F3=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
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Apologies to be clear my shifts are:
Regular: 06:00 - 16:00 (this formula I think I have)
PM: 16:00 - 22:00
Night 22:00 - 06:00
 
Upvote 0

Forum statistics

Threads
1,215,561
Messages
6,125,533
Members
449,236
Latest member
Afua

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top