Microsoft Excel Pivot Tables
A Business Software Tip by J. Carlton Collins, CPA
Accountants have long known the value of PivotTables. But they're a great data analysis tool for management, too. PivotTables allow you to create multidimensional data views by dragging and dropping column headings to move data around. J. Carlton Collins, CPA, president of ASA Research, LLC, is an accounting systems and spreadsheet expert. In this article, he'll walk you through both the basic and complex issues involved.
To rearrange the worksheet, simply drag and drop column headings to a new location on the worksheet, and Microsoft Excel crunches the data accordingly. The diagram below depicts a typical PivotTable and highlights its moveable elements.
To get started, review the following exercise, which walks through a typical PivotTable scenario.
Start with Raw Data
To begin, you first need raw data to work with. The general rule is you need more than two criteria of data to work with—otherwise you have nothing to pivot. PivotTables are especially well-suited for taking enormous amounts of data and summarizing that data into useful reports. In the example below, the marketing department for a company has tabulated the results of four different types of marketing campaigns, which were conducted in different locations during different months of the year.
It's important to note that as presented, the data is not easy to read. We can easily make a few obvious observations pertaining to this raw data. For example, on row 46, we see an October marketing direct mail campaign conducted in the Atlanta market resulted in 455 redeemed coupons. However, in its current format we cannot see summary statistics at a glance, such as the overall success of direct mail campaigns, October marketing efforts, or Atlanta marketing efforts. This is where PivotTables can help.
The PivotTable Wizard
To create a PivotTable, place the cursor anywhere in the data area (assuming the data is contiguous), and then start the PivotTable wizard from the data menu as shown below.
The PivotTable wizard will walk you though the process of creating an initial PivotTable. While there are many advanced options available to use, in this example, we will simply click the Finish button to create a quick PivotTable. The results are that Excel creates a blank PivotTable, and the user must then drag and drop the various fields from the PivotTable field list onto the appropriate column, row, or data section.
Dragging and Dropping Data
As you drag and drop these items, the resulting report is displayed "on the fly." Presented below are but a few examples of hundreds of possible reports that could be viewed with this data through the PivotTable format.
The report in the diagram below shows the total resulting sales for each marketing campaign for each of the four months marketing campaigns were conducted.
This particular PivotTable can be modified to display different results such as averages, counts, minimums, maximums, etc. The PivotTable field dialog box below shows how we can change this report to display percentages to total, instead of total amounts.
As you can see above, you must first select the PivotTable field dialog box, and then expand the box by clicking the options button. The resulting expanded dialog box is shown on the right. In this advanced options section, we then pull down the "Show data as" field and select "% to total". The resulting report is shown in the diagram below.
Here we can see our second PivotTable depicting the same information as in the first report, but this data is displayed as a percentage of the total. A few observations can now be made fairly easily. For example, we see that overall, radio spots were the most profitable type of campaign, but only in April and July. In January and October, local ads and direct mail produce better results. Furthermore, April campaigns had the best response overall. This conclusion is easily reached now that the Excel PivotTable tool has neatly summarized and organized this data.
Numeric data fields can be summarized using SUM, AVERAGE, MAX, MIN, and the other aggregate functions including COUNT. (As with the Subtotals feature, text fields can only be summarized with the COUNT function.) For example, we can use the SUM function to create a table summarizing the resulting sales for each category by month.
Creating a Second Report
The next step in mastering PivotTables is to understand how the automatic formatting controls can make data clean-up a snap. Simply pull down the Format menu and select AutoFormat.
Excel provides an assortment of 22 formats to choose from. Simply choose a format, and your data is now more readable. Additionally, these automatic formats are persistent formats, which means the table's formatting will hold even as you continue to pivot your data around by dragging and dropping additional fields on the screen.
An example of a formatted PivotTable is shown in the diagram below.
The next step is to further manipulate our data in search of additional observations and inferences. By dragging and dropping the city field onto the table and removing the month field, we see a completely different report as shown below. This action is pivoting the data—the essence of what PivotTables are all about.
Further analysis in the screen above tells us our results vary widely from one city to the next. In New York, coupons were least effective, but coupons were most effective in Columbus. This information can be valuable for planning marketing campaigns next year for individual locations.
Publishing PivotTables to the Web
Excel PivotTables can also be published on the Internet (or on an intranet) as interactive Web pages, as shown below. Simply select "Save as a Web Page" from the File menu and a Web publishing menu will walk you though this process.
The next step is to create a chart using almost the same technique described above, but this time select the Chart option rather than the Table option from the PivotTable wizard.
Just a few of the resulting chart types are shown below. Just as with PivotTables, PivotCharts are interactive as well. Simply drag and drop the data onto the chart to see instant results.
The Radar Chart is shown below.
The 3-D Surface Chart is shown below.
The 3-D Column Chart is shown below.
The 3-D Line Chart is shown below.
More Advanced PivotTable Options
The exercises above merely brush the surface of PivotTables. To push the limits, presented below are a few additional features and functionality of PivotTables that you might enjoy. Give them a try.
Creating Multiple PivotTables and PivotCharts
As shown below, each time you create a new PivotTable or chart, new worksheets are automatically inserted into your Excel workbook. It's not uncommon to create dozens of differing pivot reports and charts form one set of raw data.
Linking Raw Data to PivotTables and PivotCharts
Once you have created one or more PivotTables and charts, you can edit or change your raw data. As a default, these changes will not be reflected in your PivotTables and PivotCharts until you refresh these links using the External Data Toolbar Command or the F8 key. The External Data Toolbar is shown below.
There is a setting in the PivotTable options box that allows you to refresh PivotTables automatically as the raw data changes, or to instruct Excel to refresh PivotTables and PivotCharts at regular intervals.
Step three of the PivotTable wizard allows you the opportunity to access both the advanced options and a PivotTable layout tool.
The Layout Tool allows you to generate default field settings for the PivotTable during the wizard process. As you can see below, this screen is a little more graphical and might be preferred by some users. However, this utility does not add any additional functionality or save any particular steps.
The advanced options dialog box does offer additional functionality. As shown below, this box allows you to control grand totaling, auto formatting, merging of labels, print titles, and more. In particular, note that you can create PivotTables that are drillable to the source data—simply double click on amounts in the PivotTable or PivotChart to see a summary of the underlying data organized neatly for your review. Finally, although this option is grayed out below, you will see there is an option which will save passwords to external data sources to make refreshing PivotTables much easier. For example, you may link a PivotTable report to a database that resides on an external AS/400 computer system. Still, Excel can reach out and import current data with the click of the Refresh External Data button, without forcing the user to constantly enter the appropriate password(s). One should note that a certain amount of risk might be involved using this feature.
Linking PivotTables to External Sources
Finally, it should be pointed out that it is possible to extract data directly from an external source or multiple sources directly into an Excel PivotTable. This procedure is often referred to as an OLAP Data Cube. To perform this task, simply indicate on the opening PivotTable wizard screen your data resides on an external source, and Excel will then ask you to browse to that data source.
The dialog box below shows the Get Data options box...
...which is followed by the Choose Data Source Options box (shown below) and allows you to browse to the specific file or files containing your source data. This procedure would allow you, for example, to link a PivotTable or PivotChart directly to your accounting system's data, such as Microsoft Business Solutions–Great Plains or Microsoft Business Solutions–Navision. Thereafter, pressing the F8 key will instantly retrieve current data from your accounting system.
Complimentary Excel Tools
PivotTables work well in conjunction with other Excel tools including Subtotaling, AutoFilters, publishing to the Web, sending e-mail, printing multiple worksheets with one command, grouping, outlining, and copy and paste linking to Microsoft Word or Microsoft PowerPoint.
PivotTables just might be the single most powerful tool in Excel for financial reporting, budgeting, and data analysis. On a scale of easy to difficult, learning and mastering PivotTables leans more towards the difficult side of the scale for many users. Perseverance and the use of your own data will be most helpful in mastering this area. Once you've created many PivotTables and PivotCharts, be sure to keep your techniques a secret—you don't want anyone in your office to realize just how much Excel does for you—allow them to think that you are a genius! I recommend you invest some time and give PivotTables an honest try.
J. Carlton Collins, CPA, president of ASA Research, LLC, is an independent author, lecturer, and analyst in the accounting systems industry. He has installed more than 200 accounting systems and delivered 1,800 lectures around the world on the subject of accounting systems and technology. Collins has published extensive accounting system reviews which can be seen at www.AccountingSoftwareAdvisor.com.