I have a large spreadsheet of data collected by an experimental recognition engine. It collects time started and time finished data according to facial data. The issue I have is that the varying angles and lighting cause the recognition system to think that one person is two or three (or in one particular case, 12). I have gone through and manually edited the spreadsheet to contain the correct names of workers, but I would like to calculate the hours worked by each person.
Currently, the spreadsheet looks like this:
Name Date Time Started Time Finished
Person A 17/05/2016 10:30:20 AM 17/05/2016 10:30:20 AM 17/05/2016 10:41:18 AM
Person A 17/05/2016 10:41:20 AM 17/05/2016 10:41:20 AM 17/05/2016 10:41:20 AM
Person A 17/05/2016 11:07:09 AM 17/05/2016 11:07:09 AM 17/05/2016 11:55:24 AM
Person B 17/05/2016 10:58:30 AM 17/05/2016 10:58:30 AM 17/05/2016 10:58:30 AM
Person B 17/05/2016 10:58:42 AM 17/05/2016 10:58:42 AM 17/05/2016 10:58:42 AM
Person C 17/05/2016 10:28:05 AM 17/05/2016 10:28:05 AM 17/05/2016 11:19:28 AM
Person C 17/05/2016 10:30:26 AM 17/05/2016 10:30:26 AM 17/05/2016 11:52:56 AM
Person C 17/05/2016 10:43:30 AM 17/05/2016 10:43:30 AM 17/05/2016 11:27:20 AM
This is a sample of the code, but it goes up to Person Q.
I have arranged it in order of time last seen, so basically I would like to add a column that subtracts the final time worked from the initial time worked.
For each name, the correct Hours Worked can be calculated by subtracting the first Time Started
entry from the last Time Finished
entry. So in this example, I can find the time worked by Person C
by doing: 17/05/2016 11:27:20 AM
- 17/05/2016 10:28:05 AM
.
So far I have been doing this by hand, but I would much prefer a function that can look at data in the Name
column, and then calculate the Hours Worked
by looking for the first Time Started
entry and subtracting it from the last Time Finished
entry.
Can anyone provide some guidance on how to do this in Excel? If not, is such a thing possible in Excel-VBA?
Thanks in advance.