Determining the first & last timestamp per day, per user

MrNumbers

New Member
Joined
Jan 18, 2010
Messages
9
Hi
I have data that displays employees entering a security location (timestamp) and after the security process, exits the security location (timestamp) and enters the work area. Employees will then enter & exit the security area again after their shift ends. Employees can also move in and out of the security area as they leave to go on errands or lunch breaks.
What I want to achieve is determine how much time is spent inside the work area using the security in and out times as arrival and departure times to work out total time spent inside.
Sample data:
[TABLE="width: 578"]
<tbody>[TR]
[TD]Location
[/TD]
[TD]Employee name
[/TD]
[TD]Arrival Date
[/TD]
[TD]Arrival Time
[/TD]
[TD]Departure Date
[/TD]
[TD]Departure Time
[/TD]
[TD]Duration
[/TD]
[/TR]
[TR]
[TD]Debriefing room
[/TD]
[TD]Bob Spoon
[/TD]
[TD]2019/02/16
[/TD]
[TD]13:57:09
[/TD]
[TD]2019/02/16
[/TD]
[TD]14:01:20
[/TD]
[TD]00:04:11
[/TD]
[/TR]
[TR]
[TD]Debriefing room
[/TD]
[TD]Bob Spoon
[/TD]
[TD]2019/02/17
[/TD]
[TD]01:24:56
[/TD]
[TD]2019/02/23
[/TD]
[TD]02:23:23
[/TD]
[TD]00:58:27
[/TD]
[/TR]
[TR]
[TD]Debriefing room
[/TD]
[TD]Bob Spoon
[/TD]
[TD]2019/02/23
[/TD]
[TD]18:11:43
[/TD]
[TD]2019/02/23
[/TD]
[TD]18:11:47
[/TD]
[TD]00:00:04
[/TD]
[/TR]
[TR]
[TD]Debriefing room
[/TD]
[TD]Bob Spoon
[/TD]
[TD]2019/02/23
[/TD]
[TD]18:11:47
[/TD]
[TD]2019/02/23
[/TD]
[TD]18:13:56
[/TD]
[TD]00:02:09
[/TD]
[/TR]
[TR]
[TD]Debriefing room
[/TD]
[TD]Bob Spoon
[/TD]
[TD]2019/02/23
[/TD]
[TD]18:14:50
[/TD]
[TD]2019/02/23
[/TD]
[TD]18:17:31
[/TD]
[TD]00:02:41
[/TD]
[/TR]
[TR]
[TD]Debriefing room
[/TD]
[TD]Bob Spoon
[/TD]
[TD]2019/02/23
[/TD]
[TD]18:17:34
[/TD]
[TD]2019/02/23
[/TD]
[TD]19:08:49
[/TD]
[TD]00:51:15
[/TD]
[/TR]
[TR]
[TD]Debriefing room
[/TD]
[TD]Bob Spoon
[/TD]
[TD]2019/02/27
[/TD]
[TD]21:38:46
[/TD]
[TD]2019/02/27
[/TD]
[TD]21:39:30
[/TD]
[TD]00:00:44
[/TD]
[/TR]
[TR]
[TD]Debriefing room
[/TD]
[TD]Bob Spoon
[/TD]
[TD]2019/02/28
[/TD]
[TD]16:58:18
[/TD]
[TD]2019/02/28
[/TD]
[TD]17:27:18
[/TD]
[TD]00:29:00
[/TD]
[/TR]
[TR]
[TD]Debriefing room
[/TD]
[TD]Dave Knorris
[/TD]
[TD]2019/02/18
[/TD]
[TD]09:50:31
[/TD]
[TD]2019/02/18
[/TD]
[TD]09:55:48
[/TD]
[TD]00:05:17
[/TD]
[/TR]
[TR]
[TD]Debriefing room
[/TD]
[TD]Dave Knorris
[/TD]
[TD]2019/02/18
[/TD]
[TD]10:59:01
[/TD]
[TD]2019/02/18
[/TD]
[TD]11:00:05
[/TD]
[TD]00:01:04
[/TD]
[/TR]
[TR]
[TD]Debriefing room
[/TD]
[TD]Dave Knorris
[/TD]
[TD]2019/02/19
[/TD]
[TD]08:35:24
[/TD]
[TD]2019/02/19
[/TD]
[TD]08:37:30
[/TD]
[TD]00:02:06
[/TD]
[/TR]
[TR]
[TD]Debriefing room
[/TD]
[TD]Sam Santiago
[/TD]
[TD]2019/02/19
[/TD]
[TD]09:49:39
[/TD]
[TD]2019/02/19
[/TD]
[TD]09:50:57
[/TD]
[TD]00:01:18
[/TD]
[/TR]
[TR]
[TD]Debriefing room
[/TD]
[TD]Sam Santiago
[/TD]
[TD]2019/02/19
[/TD]
[TD]10:23:02
[/TD]
[TD]2019/02/19
[/TD]
[TD]10:24:39
[/TD]
[TD]00:01:37
[/TD]
[/TR]
[TR]
[TD]Debriefing room
[/TD]
[TD]Sam Santiago
[/TD]
[TD]2019/02/19
[/TD]
[TD]12:32:41
[/TD]
[TD]2019/02/19
[/TD]
[TD]12:49:03
[/TD]
[TD]00:16:22
[/TD]
[/TR]
</tbody>[/TABLE]

I want to achieve:
Look at the first arrival time on a specific date as “time in” and look at last “time in” on the same day. If no 2nd “time in” can be found, it means the employee worked a night shift crossing the midnight hour, resulting in you having to look for the first “time in” data on the following day. Keep in mind that the employee can then go home and come back again later that day for another shift, meaning you must account the 2nd “time in” on that date as the 1st “time in” for the next shift
Looking at Bob Spoon’s movements only:

  • Start date C2 and time D2, leaving at C3 = total time spent in work area is 11:24:56
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying

Forum statistics

Threads
1,224,823
Messages
6,181,177
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