Calculate total hours in a work week using workdays and punch in and out times

Safety_3rd

New Member
Joined
Sep 17, 2014
Messages
6
I have a list days and clock in and out times. I would like to calculate the total number of hours worked in a work week. The work week begins midnight Sunday and ends at 11:59:59 Saturday. The punch in and out times are in military format. Employees don't work every day of the week. My problems are that if an employee clocks in Saturday at 22:00 and out at 04:15 on Sunday morning 2 hours will go on the previous week and 4:15 hours in the start of the next week. The total hours need to be in decimal form not hh:mm:ss, and I cant just auto sum every 7 lines because an employee might only work 4 days in one week but all 7 in the next week. Any help would be great! Thank you.
Day of week
Punch in
Punch out
Hours
Saturday
22:00
4:15
6:15
Sunday
04:15
05:30
1:15
Monday
21:00
05:30
8:30
Tuesday
etc...
etc...
etc...
Wednesday
Thursday
Friday
Saturday
Monday
Tuesday
Wed
Thur
Fir
Mon
Tue
Wed
Thur
Fri
Sat

<tbody>
</tbody>
 
I can do it with helper columns. No doubt a genius could do it better but far as i can tell it works.

In E2: =IF(D2>C2,(D2-C2)*24,(D2-C2)*24+24)
In F2: =WEEKNUM(A2)
In G2: =IF(AND(B2="Saturday",C2>D2),D2*24,0)

In I2:I15: 1,2,3,4,etc
In J2: =SUMPRODUCT(--($F$2:$F$15=I2),$E$2:$E$15)-IFERROR(VLOOKUP(I2,$F$2:$G$15,2,0),0)+IFERROR(VLOOKUP(I2-1,$F$2:$G$15,2,0),0)

Punch Date
Day of WeekPunch In 1Punch Out 1Hours 1WeeknumAfter Sat 00:00WeeknumHours Worked
01/03/2014Saturday21:0001:004.0091.0010.00
02/03/2014Sunday01:3007:195.82100.0020.00
03/03/2014Monday01:1407:306.27100.0030.00
04/03/2014Tuesday02:3003:301.00100.0040.00
05/03/2014Wednesday01:3605:143.63100.0050.00
06/03/2014Thursday20:5601:004.07100.0060.00
07/03/2014Friday01:2106:144.88100.0070.00
08/03/2014Saturday04:1506:192.07100.0080.00
09/03/2014Sunday01:3007:205.83110.0093.00
10/03/2014Monday01:3306:124.65110.001028.73
11/03/2014Tuesday01:4606:014.25110.001126.97
12/03/2014Wednesday21:1701:053.80110.00120.00
13/03/2014Thursday01:3606:164.67110.00130.00
14/03/2014Friday01:0004:463.77110.00140.00

<colgroup><col style="mso-width-source:userset;mso-width-alt:2816;width:58pt" width="77"> <col style="mso-width-source:userset;mso-width-alt:3108;width:64pt" width="85"> <col style="mso-width-source:userset;mso-width-alt:2560;width:53pt" width="70"> <col style="mso-width-source:userset;mso-width-alt:2962;width:61pt" width="81"> <col style="mso-width-source:userset;mso-width-alt:2157;width:44pt" width="59"> <col style="mso-width-source:userset;mso-width-alt:2596;width:53pt" width="71"> <col style="mso-width-source:userset;mso-width-alt:3547;width:73pt" width="97"> <col style="width:48pt" width="64"> <col style="mso-width-source:userset;mso-width-alt:2596;width:53pt" width="71"> <col style="mso-width-source:userset;mso-width-alt:3510;width:72pt" width="96"> </colgroup><tbody>
</tbody>
 
Upvote 0

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result

Forum statistics

Threads
1,215,523
Messages
6,125,318
Members
449,218
Latest member
Excel Master

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