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

Posted on 2015-02-03
Last Modified: 2015-02-17
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
Question by:Danny Child
  • 5
  • 3
LVL 24

Expert Comment

by:Phillip Burton
ID: 40586263
Yes, a PivotTable would be perfect for you.

See attached.
LVL 24

Expert Comment

by:Phillip Burton
ID: 40586273
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.
LVL 23

Author Comment

by:Danny Child
ID: 40586340
Thanks Phillip, starting the reading now...
by the way, was there supposed to be an attachment on your first post?
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

LVL 24

Expert Comment

by:Phillip Burton
ID: 40586345
LVL 24

Expert Comment

by:Phillip Burton
ID: 40586349
Have a look at the spreadsheet first, then see the articles, and you will see how easy it can be to do this.
LVL 23

Author Comment

by:Danny Child
ID: 40586410
Thanks, that does indeed look ideal.  I'll give it some time to get my head around it...
LVL 24

Accepted Solution

Phillip Burton earned 500 total points
ID: 40586538
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.
LVL 23

Author Closing Comment

by:Danny Child
ID: 40615994
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.

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
Convert between Excel file formats (.XLS, .XLSX, .XLSM) with/without macro option David Miller (dlmille) Intro Over this past Fall, I've had the opportunity to see several similar requests and have developed a couple related solutions associate…
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question