Grouping Dates with Pivot Tables
July 29, 2011 Leave a comment
I am not a gambling man. But if I were, I’d bet a million dollars that you will never ever grasp all that Microsoft Excel has to offer. Fine with me because that means we can learn something new just about every day. Pivot Tables provide a perfect example.
I’v raved about Pivot Tables in the past , praising the power and flexibility of this Excel feature. In literally seconds, you can slice and dice data any way you wish to see just the data you need to make informed decisions. (See prior post on Pivot Tables)
The journey between just learning about Pivot Tables and being able to effectively implement and use them is indeed a short one. But take just a few more steps and you’ll find additional ways to save time, while adding helpful details to your information and analysis. Let’s say, for example your company keeps records for each sales transaction. A simplified table might include the name of the salesperson along with the date and amount of the transaction.
Using just the basic elements of Pivot Tables, one can easily produce a table showing the total sales for each date and each salesperson. (See Illustration). But having data laid out in this manner is not completely helpful. A better way to group the information might be by year, quarter, or month. Or all three. There are, of course, many ways to add those levels of grouping when producing this pivot table. Those new to Pivot Tables might add columns to the raw data, converting the date to columns for the month (using the month() function), year (using the year() function), and quarter (applying the roundup() function to a simple equation: monthNumber/3- see :What Quarter is It?). Even adding one for the week wouldn’t be that difficult.
There is, of course, an easier way. As you learn more and more about Excel, you’ll discover that more and more often- that something you did one way for months or years has a much easier solution.
So let’s dive in. If you have data with date as one of the fields (columns), you can easily group and categorize it. Follow these simple instructions:
- Once the basic pivot table is created and the date field is set to (dragged to) one of the row headers, simply right-click on any of the dates.
- A drop down list will appear; select “Group”
- Select any or all of the grouping options (year, month, day, etc.) you want to include
- Select OK
- That’s it! To UnGroup the data, simply right-click any date field and Select “UnGroup”