Introduction To Pivot Tables
Many Excel users are not familiar with, or are intimidated by Pivot Tables, one
of the most powerful features in Excel. This page describes elementary Pivot Tables.
This page was written by Harald Staff, and is included here with his kind
permission.
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
A pivot table is a great reporting tool that sorts and sums independent of the original
data layout in the spreadsheet. If you never used one, this demo may be of interest. |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
First, set up a create some data, in A1:D50, like this, with 4 or 5 different names, 4 or
5 different activities and a little variety of week numbers and expenses:
Add as many rows as you can stand -- around 50 will do. Now comes the layout wizard, show below. |
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Drag the headers Who, Week and What into the ROW area, and the Amount header into the Data area. (Leave the Column area blank for now.) If the Amount tag does not show "Sum of Amount", double-click it and choose the Sum option. Finally Excel asks if the table should be placed in a new worksheet. Click OK. Now you have your table, and it looks very much like a sorted version of the original data list, except from the automatic subtotals. Now comes the cool stuff: |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Double-clicking the headers gives options of showing/hiding specific data (like Empty and Beer, may come in handy) and removing subtotaling for this column. Right-clicking gives other options, among them Hide and Show Detail for reading totals only.
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Here comes another useful pivot, made from the same list. Select any item in the original
data list and choose Pivot Table wizard again. This time, drag Who into
the Row field, What into the Column field and Amount
into the Data field. Voil�. This table is -among other things- very useful for graphing.
|
|||
The only tricky thing is this: You have to update the table manually from the Data menu. A Pivot table does not update itself. If this becomes boring, here is some macro code that makes the tables update on selecting the worksheet: Sub Auto_Open() Application.OnSheetActivate = "UpdateIt" End Sub Sub UpdateIt() Dim iP As Integer Application.DisplayAlerts = False For iP = 1 To ActiveSheet.PivotTables.Count ActiveSheet.PivotTables(iP).RefreshTable Next Application.DisplayAlerts = True End Sub |
|
||
|