Calculating exact shift times and rates per shift.

MECH427

New Member
Joined
May 31, 2019
Messages
2
Hello,
I am trying to find a couple formulas to extract the amount of hours worked on each shift. Time is entered beginning and end of a shift and may include a portion of all 3 shifts. 1st shift is 6am - 2pm, 2nd shift is 2pm - 10pm, 3rd shift is 10pm - 6am. Example if I punch in at 5:45pm and punch out at 6:30 am my time should show .5 hour on 1st, 4.25 hours on 2nd, and 8 hours on 3rd.
I was able to get 3rd shift, but 1st and second shift is killing me.

Start time (A5) / End Time (B5) / First shift hours (C5) / Second shift hours (D5) / Third shift hours (E5)

Any help for cells C5 and D5 would be greatly appreciated!

Thank you
Cal
*******************
ABCDE
11st shift6:00:00 AM2:00:00 PM
22nd shift2:00:00 PM10:00:00 PM
33rd shift10:00:00 PM6:00:00 AM
4START
TIME
END
TIME
1st Shift2nd Shift3rd Shift
55:56:00 PM6:15:00 AM0.254.078.00
64:00:00 PM4:00:00 AM6.00
712:00:00 PM12:15:00 AM2.25
85:40:00 AM5:00:00 PM0.33

<colgroup><col style="width: 25pxpx"><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet1

Worksheet Formulas
CellFormula
E5=MOD(B5-A5,1)*24-(B5<A5)*(22-6)-MEDIAN(B5*24,22,6)+MEDIAN(A5*24,22,6)
E6=MOD(B6-A6,1)*24-(B6<A6)*(22-6)-MEDIAN(B6*24,22,6)+MEDIAN(A6*24,22,6)
E7=MOD(B7-A7,1)*24-(B7<A7)*(22-6)-MEDIAN(B7*24,22,6)+MEDIAN(A7*24,22,6)
E8=MOD(B8-A8,1)*24-(B8<A8)*(22-6)-MEDIAN(B8*24,22,6)+MEDIAN(A8*24,22,6)

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
Welcome to Mr Excel forum

Maybe something like this

A
B
C
D
E
F
G
1
1st Shift​
2nd Shift​
3rd Shift​
2
StartTime​
6:00:00 AM​
2:00:00 PM​
10:00:00 PM​
3
EndTime​
2:00:00 PM​
10:00:00 PM​
6:00:00 AM​
4
5
StartTime​
EndTime​
1st Shift​
2nd Shift​
3rd Shift​
6
5:56:00 PM​
6:15:00 AM​
0,25​
4,07​
8,00​
7
4:00:00 PM​
4:00:00 AM​
0,00​
6,00​
6,00​
8
12:00:00 PM​
12:15:00 AM​
2,00​
8,00​
2,25​
9
5:40:00 AM​
5:00:00 PM​
8,00​
3,00​
0,33​
10
5:45:00 PM​
6:30:00 AM​
0,50​
4,25​
8,00​
11

<tbody>
</tbody>


Formula in D6 copied across and down
=MAX(0,MIN($B6+($A6>$B6),D$3+($A6>=D$3))-MAX($A6,D$2-(D$2>D$3)+($A6>=D$3)))*24

Format D6:F10 as Number with two decimal places

Hope this helps

M.
 
Upvote 0
Thank you Marcelo.

Time and date calculations really get the better of me! I appreciate you taking the time and effort to help me solve this!

Cal
 
Upvote 0

Forum statistics

Threads
1,213,494
Messages
6,113,986
Members
448,538
Latest member
alex78

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