Timesheet analysis from list of events - find Earliest/Latest per day to calculate duration.

I've got a list of events generated by a door pass security system.  I need to find the earliest event for each day, and then the latest for that same day, and hence the onsite duration.

The list of events just runs in time order through the whole month, and there could be any number of events during the day.

Ultimately, I need to build monthly totals, but just want to figure out a good way of getting the daily values for now.

I've written some formulae to check when the date changes (ie a first or last event), but I can't figure how to subtract that from the previous event when there's an unknown number of rows in between.

Sorry, I have no VBA skills to speak of, and am a bit ignorant about PivotTables, both of which may help.  Happy to learn, though!

The attached file is a summary, but there will be more data - approx. 600 rows/person for a month is not uncommon.
Cheers, Danny
LVL 23
Danny ChildIT ManagerAsked:
Who is Participating?
Phillip BurtonConnect With a Mentor Director, Practice Manager and Computing ConsultantCommented:
Create a PivotTable as the first article, and then group by Day as per the second article.

Then add the date field twice to the values, and change one to Min (double-click on it to get that dialog box) and one to Max.

Then add a formula to get the difference.
Phillip BurtonDirector, Practice Manager and Computing ConsultantCommented:
Yes, a PivotTable would be perfect for you.

See attached.
Phillip BurtonDirector, Practice Manager and Computing ConsultantCommented:
You say that you are "happy to learn" about PivotTables. Then can I suggest a very quick, crash, course. All of four pages. :-)

This first article introduces how you do a basic PivotTable.

The second article is about working with PivotTable date ranges, and shows how I did this date analysis (but you need to read the first article first).

The third is about adding graphs and interactivity to PivotTables, and the fourth includes more interactivity with Timelines.

Hope it helps.
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Danny ChildIT ManagerAuthor Commented:
Thanks Phillip, starting the reading now...
by the way, was there supposed to be an attachment on your first post?
Phillip BurtonDirector, Practice Manager and Computing ConsultantCommented:
Phillip BurtonDirector, Practice Manager and Computing ConsultantCommented:
Have a look at the spreadsheet first, then see the articles, and you will see how easy it can be to do this.
Danny ChildIT ManagerAuthor Commented:
Thanks, that does indeed look ideal.  I'll give it some time to get my head around it...
Danny ChildIT ManagerAuthor Commented:
Worked perfectly.  How I did it:
Had my enormous list of events, clicked any cell in them.
Insert tab.. PivotTable - dialog box appears at right.
Drag my Date/Time entry from the top of the dialog box to the Row Labels box, lower left.
R-click the newly created date colum, and unselect the Grouping entry for Months, and instead pick Days.
Drag my Date/Time entry down again, but this time to the Values box, lower right.  Repeat this.
on the 2 newly created columns, r-click one to show Min, and the other to show Max.
add some columns to subtract Min from Max, giving Hours/Day.

had to monkey about with date and time formatting to get it pretty, and also I threw in some  SumIf statements to calculate weekly and monthly totals, but all good.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.