| We work under a union contract that
pays a penalty if we are not broken
for a meal after 6 hours. if we
work a long day (which is not
unusual) we go into meal penalty
again 6 hours after we are back in
from lunch. there is an additional
penalty every half hour after the
meal is due until a meal break is
called. the first two penalties are
fixed amounts ($10 & $15). the
third and all subsequent meal
penalties are an hour of pay at the
rate you are at when the penalty
occurs (we call them
"prevailing rate
penalties"). in other words,
if you are in time and a half when
that third penalty occurs, you get
an hour of pay at time and a half.
if we are in double-time, the
penalty is an hour of pay at
double-time.
our overtime structure is:
first 8 hours - straight time
8-12 hours - 1.5x
12-14 hours - 2x
14+ - 2.5x
the problem i am having is coming
up with an expression in excel to
calculate the dollar amount of meal
penalties for that second meal.
because the time we break for lunch
is variable, the time from when we
are back on the clock from lunch
until we go into overtime is never
the same. can anyone help?
as an example, let's say our
hours for a given day are:
start work at 7:00am
we break for lunch from 1:25 -
1:55pm
we finish work at 10:24pm
in this example, we were due our
lunch break at 1:00pm (6 hours
after we start work) so we would
get 1 lunch penalty.
we were back on the clock from
lunch at 1:55pm so we were due a
2nd meal break at 7:55pm. we would
incur 2nd meal penalties starting
then and every half hour after that
until the end of the work day, so
the penalties would occur at:
7:55 = $10
8:25 = $15
8:55 = 1 hour of 2x
9:25 = 1 hour of 2x
9:55 = 1 hour of 2.5x
the first two penalties are still
fixed amounts. we go into double
time after twelve hours, which is
7:30pm, and double and a half time
at 9:30pm (the half hour lunch is
off the clock). the third and forth
penalties occur after 12 hours so
they are each an hour of double
time. the fourth occurs after 14
hours so it is at double and a half
time.
the only thing to simplify this a
little is that the prevailing rate
2nd meal penalties after will
always be at least time and a
half.
thanks!
Let's set up a worksheet like this:
Cell / Entry
A1: In1
B1: Out1
C1: In2
D1: Out2
E1: Hourly Rate
F1: Hours1
G1: Hours2
H1: Straight
I1: 1.5x
J1: 2x
K1: 2.5x
L1: Penalty Count 1
M1: Penalty Count 2
N1: Penalty Amount 1
O1: Penalty Amount 2
A2: [enter the start time for before break]
B2: [before break end time]
C2: [after break start time]
D2: [after break end time]
E2: [enter an hourly base rate]
F2: =IF(B2="",0,24*(B2-A2))
G2: =IF(D2="",0,24*(D2-C2))
H2: =MIN(8,SUM(F2:G2))
I2: =MIN(4,SUM(F2:G2)-MIN(8,SUM(F2:G2)))
J2: =MIN(2,SUM(F2:G2) -MIN(12,SUM(F2:G2)))
K2: =SUM(F2:G2) -MIN(14,SUM(F2:G2))
L2: =IF(F2<=6,0, CEILING(48*(B2-A2-0.25),1))
M2: =IF(G2<=6,0, CEILING(48*(D2-C2-0.25),1))
N2:
=IF(F2<=6,0,10)
+IF(F2<=6.5,0,15)
+IF(F2<=7,0,E2)
+IF(F2<=7.5,0,E2)
+IF(F2<=8,0,E2)
+IF(F2<=8.5,0,E2*1.5)
+IF(F2<=9,0,E2*1.5)
+IF(F2<=9.5,0,E2*1.5)
+IF(F2<=10,0,E2*1.5)
+IF(F2<=10.5,0,E2*1.5)
O2:
=IF(G2<=6,0,10)
+IF(G2<=6.5,0,15)
+IF(G2<=7,0,IF(F2+6<=8,1, IF(F2+6<=12,1.5, IF(F2+6<=14,2,2.5)))*E2)
+IF(G2<=7.5,0,IF(F2+6.5<=8,1, IF(F2+6.5<=12,1.5, IF(F2+6.5<=14,2,2.5)))*E2)
+IF(G2<=8,0,IF(F2+7<=8,1, IF(F2+7<=12,1.5, IF(F2+7<=14,2,2.5)))*E2)
+IF(G2<=8.5,0,IF(F2+7.5<=8,1, IF(F2+7.5<=12,1.5, IF(F2+7.5<=14,2,2.5)))*E2)
+IF(G2<=9,0,IF(F2+8<=8,1, IF(F2+8<=12,1.5, IF(F2+8<=14,2,2.5)))*E2)
+IF(G2<=9.5,0,IF(F2+8.5<=8,1, IF(F2+8.5<=12,1.5, IF(F2+8.5<=14,2,2.5)))*E2)
+IF(G2<=10,0,IF(F2+9<=8,1, IF(F2+9<=12,1.5, IF(F2+9<=14,2,2.5)))*E2)
+IF(G2<=10.5,0, IF(F2+9.5<=8,1, IF(F2+9.5<=12,1.5, IF(F2+9.5<=14,2,2.5)))*E2)
You can copy each formula above (including multi-line ones) and paste them directly into their respective cells in Excel and they will work. Entering time values in Excel is a pain, but I assume you already know that. I have set this up all on one line so that you could have one line for each worker allowing you to easily calculate totals. This works for maximum stretches of 11 hours before breaks (both before and after lunch). Any stretch beyond 11 hours won't get additional penalties. There are a few extras that you didn't really ask for, like hours at each OT rate, but I thought might come in handy.
Alternately, you could replace the formulas in cells N2 and O2 with these formulas:
=PenaltyAmount1(A2,B2,E2)
=PenaltyAmount2(A2,B2,C2,D2,E2)
Then paste the following code into a regular Module in the VB Editor:
Const FirstPenaltyAmount = 10
Const SecondPenaltyAmount = 15
Function PenaltyAmount1(Start1 As Range, End1 As Range, dblRate As Double) As Double
Dim dblHours1 As Double
Dim dblResult As Double
Dim dblPrevailingTime
Dim intPenalty As Integer
Dim sglMult As Single
dblHours1 = 24 * (End1.Value - Start1.Value)
If dblHours1 <= 6 Then
dblResult = 0
ElseIf dblHours1 <= 6.5 Then
dblResult = FirstPenaltyAmount
ElseIf dblHours1 <= 7 Then
dblResult = FirstPenaltyAmount + SecondPenaltyAmount
Else
dblResult = FirstPenaltyAmount + SecondPenaltyAmount
intPenalty = 2
Do While dblHours1 > 6 + intPenalty * 0.5
dblPrevailingTime = 6 + intPenalty * 0.5
sglMult = PrevailingRateMult( dblPrevailingTime)
dblResult = dblResult + dblRate * sglMult
intPenalty = intPenalty + 1
Loop
End If
PenaltyAmount1 = dblResult
End Function
Function PenaltyAmount2(Start1 As Range, End1 As Range, Start2 As Range, End2 As Range, dblRate As Double) As Double
Dim dblHours1 As Double
Dim dblHours2 As Double
Dim dblTotalHours As Double
Dim dblResult As Double
Dim dblPrevailingTime
Dim intPenalty As Integer
Dim sglMult As Single
dblHours1 = 24 * (End1.Value - Start1.Value)
dblHours2 = 24 * (End2.Value - Start2.Value)
dblTotalHours = dblHours1 + dblHours2
If dblHours2 <= 6 Then
dblResult = 0
ElseIf dblHours2 <= 6.5 Then
dblResult = FirstPenaltyAmount
ElseIf dblHours2 <= 7 Then
dblResult = FirstPenaltyAmount + SecondPenaltyAmount
Else
dblResult = FirstPenaltyAmount + SecondPenaltyAmount
intPenalty = 2
Do While dblHours2 > 6 + intPenalty * 0.5
dblPrevailingTime = dblHours1 + 6 + intPenalty * 0.5
sglMult = PrevailingRateMult( dblPrevailingTime)
dblResult = dblResult + dblRate * sglMult
intPenalty = intPenalty + 1
Loop
End If
PenaltyAmount2 = dblResult
End Function
Private Function PrevailingRateMult(dblTime As Double) As Single
If dblTime <= 8 Then
PrevailingRateMult = 1
ElseIf dblTime <= 12 Then
PrevailingRateMult = 1.5
ElseIf dblTime <= 14 Then
PrevailingRateMult = 2
Else
PrevailingRateMult = 2.5
End If
End Function
Hope that helps...
|