Monday, July 5, 2010

Tip for displaying the HOUR only in Excel

Situation:  you have pulled some date/time data from another source (in my case SharePoint) but don't know how to group/aggregate the data so that you can determine which hour of the day had the most entries.  Grouping itself tends to be a little messy in Excel and requires a decent amount of work to separate all the pieces out by you.  Here's a nifty little formula that uses just nested IF statements to determine what hour of the day (in military time) the event occurred so you can then run functions like the average number of entries or the total of them - and H2 happens to be the cell where my date/time value was located:

This is based on these calculations (they ARE rounded so you may have to tweak them ever so slightly):
8am = .33
9am = .375
10am = .4167
11am = .4583
12pm = .5
1pm = .5417
2pm = .5833
3pm = .625
4pm = .6667
5pm = .7083

No comments:

Post a Comment