Splitting hours worked into multiple shift patterns

esset

New Member
Joined
Oct 18, 2023
Messages
4
Office Version
  1. 365
Platform
  1. Windows
I am trying to allocate hours worked to multiple shift patterns. I thought I found a solution in a different thread however it is not 100% right.
In some cases the formulas don't work.
Any help would be appreciated.


Cell Formulas
RangeFormula
D9D9=IF($B$2="","",TEXT(B1,"uu:mm")&"-"&TEXT(B2,"uu:mm"))
E9E9=IF($B$3="","",TEXT(B2,"uu:mm")&"-"&TEXT(B3,"uu:mm"))
F9F9=IF($B$4="","",TEXT(B3,"uu:mm")&"-"&TEXT(B4,"uu:mm"))
G9G9=IF($B$5="","",TEXT(B4,"uu:mm")&"-"&TEXT(B5,"uu:mm"))
H9H9=IF($B$6="","",TEXT(B5,"uu:mm")&"-"&TEXT(B6,"uu:mm"))
I9I9=IF($B$7="","",TEXT(B6,"uu:mm")&"-"&TEXT(B7,"uu:mm"))
D10D10=C2
E10E10=C3
F10F10=C4
G10G10=C5
H10H10=C6
I10I10=C7
D13:D25D13=IF($B$2="","",IF(COUNT($B13:$C13)=2,MAX(0,MIN($B$2,$C13+($C13<$B13))-MAX($B13,$B$1))+MAX(0,MIN($B$2+1,$C13+($C13<$B13))-1),""))
E13:E25E13=IF($B$3="","",IF(COUNT($B13:$C13)=2,MAX(0,MIN($B$3,$C13+($C13<$B13))-MAX($B13,$B$2)),""))
F13:F25F13=IF($B$4="","",IF(COUNT($B13:$C13)=2,MAX(0,MIN($B$4,$C13+($C13<$B13))-MAX($B13,$B$3)),""))
G13:G25G13=IF($B$5="","",IF(COUNT($B13:$C13)=2,MAX(0,MIN($B$5,$C13+($C13<$B13))-MAX($B13,$B$4)),""))
H13:H25H13=IF($B$6="","",IF(COUNT($B13:$C13)=2,MAX(0,MIN($B$6,$C13+($C13<$B13))-MAX($B13,$B$5)),""))
I13:I25I13=IF($B$7="","",IF(COUNT($B13:$C13)=2,MAX(0,MIN($B$7,$C13+($C13<$B13))-MAX($B13,$B$6)),""))
J13:J25J13=IF(COUNT($B13:$C13)=2,$C13-$B13+($C13<$B13),"")
K13:K25K13=SUM(D13:I13)
L13:L25L13=J13-K13
Cells with Conditional Formatting
CellConditionCell FormatStop If True
L13:L25Cell Value>0textNO
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Apparently that is not correct all the time either.
 
Upvote 0
I finally figured it out. Here is the formula that works in all situations:

Map2
ABC
108:00
217:00
3
4startendshift
519:0009:3001:30
611:3022:0005:30
706:0021:0009:00
Blad1
Cell Formulas
RangeFormula
C5:C7C5=IF($A5<$B5,MAX(0,MIN($B5,$A$2)-MAX($A5,$A$1)),MAX(0,$A$2-MAX($A5,$A$1))+MAX(0,MIN($B5,$A$2)-$A$1))
 
Upvote 0
Solution

Forum statistics

Threads
1,215,071
Messages
6,122,964
Members
449,094
Latest member
Anshu121

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