Formula for Counting No. of Hours Worked Based on Se Schedule Excluding Time Outside of Schedule

Zedrick13

Board Regular
Joined
Sep 8, 2018
Messages
100
Hi, everyone. Sorry if the title is kinda vague, but what I was trying to do is coming up with a formula for computing the number of work hours for each employee based on their schedule against their timestamps. Then, also compute their lates and absences. Here's how my tables would look like:

Table 1

Book1
ABCD
1Timestamps
2Staff IDDateTime InTime Out
310000101-Nov08:59:3617:01:04
410000201-Nov08:45:0117:15:50
510000301-Nov09:13:0517:45:01
610000401-Nov08:07:5617:30:36
710000102-Nov08:59:4517:07:18
810000202-Nov08:30:3117:10:22
910000302-Nov08:56:4518:03:45
1010000402-Nov08:39:0917:15:16
1110000105-Nov09:45:3317:14:10
1210000205-Nov09:20:0917:04:54
1310000305-Nov09:03:0716:57:50
1410000206-Nov08:36:4716:58:01
1510000306-Nov08:54:4917:11:22
1610000406-Nov08:58:5917:22:23
Sheet1


Table 2

Book1
ABCD
18Schedule
19Staff IDDateShift StartShift End
2010000101-Nov08:00:0017:00:00
2110000201-Nov08:00:0017:00:00
2210000301-Nov08:00:0017:00:00
2310000401-Nov08:00:0017:00:00
2410000102-Nov08:00:0017:00:00
2510000202-Nov08:00:0017:00:00
2610000302-Nov08:00:0017:00:00
2710000402-Nov08:00:0017:00:00
2810000105-Nov08:00:0017:00:00
2910000205-Nov08:00:0017:00:00
3010000305-Nov08:00:0017:00:00
3110000405-Nov08:00:0017:00:00
3210000106-NovOn LeaveOn Leave
3310000206-Nov08:00:0017:00:00
3410000306-Nov08:00:0017:00:00
3510000406-Nov08:00:0017:00:00
Sheet1


So, based on the schedule and the timestamps above, I want columns C-F populated with the number of hours worked per each employee per day counted only within the shift start and end based on each employee's timestamp.

Examples:
1. For 10001 (01-Nov) - count only the hours from 08:00:00 to 17:00:00
(Employee timed in early and timed in after shift end - count only the hours between 8AM-5PM) - C39
2. For 10002 (05-Nov) - count only the hours from 09:20:09 to 17:00:00
(Employee timed in late and timed out after 5PM - count only the hours between 09:20:09 to 17:00:00 (5PM)) - E40
3. For 10003 (05-Nov) - count only the hours from 09:03:07 to 16:57:50
(Employee timed in late and timed out before the shift end - count only the hours between 09:03:07 tp 16:57:50) - E41


Table 3

Book1
ABCDEFGH
37Calculation
38Staff IDRate/Hr01-Nov02-Nov05-Nov06-NovLatesAbsences
3910000120
4010000215
4110000315
4210000420
Sheet1
 
Last edited:

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
are the shifts for everyone always 08:00 to 17:00
what other entries can be seen on the schedule sheet ?
you are just showing 08:00 to 17:00 and an entry for "On Leave"
is that all you ever have in the schedule?
Are these tables - just on seperate Sheets on the same excel workbook?
 
Upvote 0
The tables and the values included are just for the sake of illustration. The schedule in the spreadsheet I am trying to build will be more varied. The (1) monthly schedule, (2) timestamps, and (3) calculation of hours and salary is going to be on 3 different sheets. Thanks
 
Upvote 0
would be worth know the detail - as it may change the solution completely and as we have to lookup and check a few values - it maybe via a reference lookup or a simple nested IF
I maybe disappearing now offline for a while - something has comeup
 
Last edited:
Upvote 0
ok, i'm back - but looking at the requirment , is going to need quite a bit of work and so we really need to have all the possible entries in Actual and Scheduled
I suggested a Helper sheet to setup the times to use
Shift patterns , what are all the possibilities
Employee , maximum number you plan to monitor
Days how many days - Just a week ?
At the moment your example shows a Thursday to Tuesday - so do they work over the weekend?
Please answer as much as possible - as i say this could be a lot of work

https://www.dropbox.com/s/1paj6jkulehjtlx/lookup - SCH v ACT.xlsx?dl=0
 
Last edited:
Upvote 0
Sorry for the late response. I'll be sure to add the details. I'll just finish it up. Thanks.
 
Upvote 0

Forum statistics

Threads
1,214,905
Messages
6,122,172
Members
449,071
Latest member
cdnMech

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