Rota start/finish times including a break

~TaC~

New Member
Joined
Dec 16, 2016
Messages
15
Hi,

I have an ongoing project where I fill in cells of scheduled work times for staff that results in displaying their start and finish times, sometimes over 7 hours and always 8 hours or more this will include a scheduled unpaid break so this time needs to be deducted. My current formula does all of this but sometimes when deducting the break the finish time is incorrectly adjusted. For example, staff member works 8 hours and takes half hour break, 8am-4pm, this displays correctly. Using same formula, they work 6 hours 8am-2pm no break and finish time shows as 1:30pm.

Here's how I have it set up.

Column A=staff name, B=contracted hours, C=5am-6am, D=6am-7am.... up to T=10pm-11pm, U=empty space, V=Start time, W=Finish time, X=Lunch break, Y=Hours worked

Row 3=Staff 1, 4=Staff 2 etc.

Formula in V for start time is
=IFERROR(TEXT(DOLLARFR(MATCH(TRUE,INDEX($C3:$T3<>"",,),0)+LEFT($C$2,FIND("-",$C$2)-1)-INDEX($C3:$T3,MATCH(TRUE,INDEX($C3:$T3<>"",,),0)),60),"00.00"),"")

Formula in W for finish time is
=IFERROR(TEXT(DOLLARFR($Y3+($Y3>=6)*0.5+DOLLARDE(V3,60),60),"00.00"),"")

Formula in Y for hours worked is
=IF(A3="","",COUNTA(C3:T3)-(SUM(COUNTIF(C3:T3,{"LE","LL"})/2))) where LE & LL represent Lunch Early & Lunch Late meaning the first or last half hour of the hour (this is a separate project where I then want to display the lunch break time).

I'm pretty much a novice in doing this and have had help to get this far so any Excel jargon may confuse me but any help is much appreciated
rota.jpg
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
have you tried testing for the length of shift and only applying the break when shift is greater than X
 
Upvote 0
Current setup

[TABLE="class: grid, width: 700, align: left"]
<tbody>[TR]
[TD][/TD]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[TD]E[/TD]
[TD]F[/TD]
[TD]G[/TD]
[TD]H[/TD]
[TD]I[/TD]
[TD]J[/TD]
[TD]K[/TD]
[TD]L[/TD]
[TD]M[/TD]
[/TR]
[TR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T(DOLLARFR($M2+($M2>=7)*0.5+DOLLARDE(J2,60),60),"00.00"),"")

M2 =COUNTA(B2:I2)-(SUM(COUNTIF(B2:I2,{"LE","LL"})/2)))

J2 works fine for all start times in column J
K2 displays incorrect finish time for hours that are less than 8 per day (K5)
M2 counts the total number of paid hours worked in a day deducting the break time, where LE represents Lunch Early (first half hour of the hour) and LL represents Lunch Late (last half hour of the hour)

I currently have no formula for L2 to show the time of break.

This is what I am hoping to achieve

[TABLE="class: grid, width: 700, align: left"]
<tbody>[TR]
[TD][/TD]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[TD]E[/TD]
[TD]F[/TD]
[TD]G[/TD]
[TD]H[/TD]
[TD]I[/TD]
[TD]J[/TD]
[TD]K[/TD]
[TD]L[/TD]
[TD]M[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD][/TD]
[TD]7-8[/TD]
[TD]8-9[/TD]
[TD]9-10[/TD]
[TD]10-11[/TD]
[TD]11-12[/TD]
[TD]12-1[/TD]
[TD]1-2[/TD]
[TD]2-3[/TD]
[TD]Start[/TD]
[TD]Finish[/TD]
[TD]Lunch[/TD]
[TD]Total[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]Staff 1[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]LE[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]07.00[/TD]
[TD]15.00[/TD]
[TD]12.00[/TD]
[TD]7.5[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]Staff 2[/TD]
[TD][/TD]
[TD][/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD][/TD]
[TD]09.00[/TD]
[TD]14.00[/TD]
[TD][/TD]
[TD]5[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]Staff 3[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]LL[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]07.00[/TD]
[TD]15.00[/TD]
[TD]12.30[/TD]
[TD]7.5[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]Staff 4[/TD]
[TD][/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]LL[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]08.00[/TD]
[TD]15.00[/TD]
[TD]11.30[/TD]
[TD]6.5[/TD]
[/TR]
</tbody>[/TABLE]










I'm not sure how your suggestion would fit in to this situation
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,178
Members
453,021
Latest member
Justyna P

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