22

PivotTables

PivotTables are an extension of the cross tabulation tables used in presenting statistics, and can be used to summarize complex data in a table format. An example of cross tabulation is a table showing the number of employees in an organisation, broken down by age and sex. PivotTables are more powerful and can show more than two variables, so they could be used to show employees broken down by age, sex, and alcohol, to quote an old statistician's joke. PivotTables are especially useful when you need to view data in a format that is not already provided by a report. It's in your best interest to not only provide reports in your applications, but to allow the end user to extract the data so they can view and manipulate it using Excel. Following our suggestion will save you a lot of time.

The input data to a PivotTable can come from an Excel worksheet, a text file, an Access database, or a wide range of external database applications. They can handle up to 256 variables, if you can interpret the results. They can perform many types of standard calculations such as summing, counting, and averaging. They can produce subtotals and grand totals.

Data can be grouped as in Excel's outline feature and you can hide unwanted rows and columns. You can also define calculations within the body of the table. PivotTables are also very flexible if you want to change the layout of the data and add or delete variables. In Excel 2003, you can create charts that are linked to your PivotTable ...

Get Excel 2003 VBA Programmer's Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.