Pivot Tables Explained
Pivot Tables Explained
Pivot Tables Explained
Pivot tables are a manager's dream. They allow you to "slice and dice" data in all sorts
of ways. Essentially, you use pivot tables to break down variables like revenue or items
sold by categories, such as region, month, and store.
Pivot tables have been in Excel since the late 1990s, and each new version has changed
them slightly. Then Excel 2007 made significant changes to the user interface for pivot
tables. Minor changes have then been made in Excel 2010 and 2013. Regardless of the
version, an argument can be made that no tool in any software package enables you to
get as much information as quickly and easily as Excel's pivot tables.
The only thing that makes pivot tables difficult for some users is that there are so many
options. Whole books have been written about pivot tables. However, rather than read
such books, you can learn the essentials discussed here and then experiment. Don't
worry about making mistakes. Pivot tables are very forgiving, and if nothing else, you
can always start over.
The data set starting in column AA is typical. Each row is a sale to some customer.
The last two variables, Items Ordered and Total Cost, are numeric, so they are
candidates for breaking down by the categorical variables to their left.
To create a pivot table, select any cell in the data set and click the Pivot Table button
on the Insert ribbon. Excel guesses the data range, which you can override if
necessary, and it asks where you want the pivot table to be placed. (Throughout this
topic, refer to the screenshots to the right.)
Try it! Create a pivot table from this data set, and place it on a new worksheet. You
can then use this pivot table to try all of the modifications discussed below. (Note
that there are no pivot tables on this Topic sheet. It contains only screen captures of
pivot tables; they are not "live.")
You will see a blank pivot table as shown to the right, and if the active cell is inside
it, you will see a PivotTable Fields pane and two PivotTable Tools tabs, Analyze and
Design. (The Analyze ribbon was called Options before Excel 2013.) Just remember
that the Fields pane and the pivot table tabs are visible only when the pivot table is
selected. So if they disappear, you now know why.
The key is the PivotTable Fields pane. The top section shows all of the available
fields (columns), and the bottom section shows the four areas you can drag these
to. Rather than read through a long explanation, try the following:
Drag Gender to the Rows area, Region to the Columns area, Paid With to the Filters
area, and Total Cost to the Values area. You have just broken down Total Cost by
Gender, Region, and Paid With. Each number in the pivot table is the sum of Total
Cost for its category values. (See the typical pivot table screenshot below and to the
right.)
Drag Gender to the Rows area, Region to the Columns area, Paid With to the Filters
area, and Total Cost to the Values area. You have just broken down Total Cost by
Gender, Region, and Paid With. Each number in the pivot table is the sum of Total
Cost for its category values. (See the typical pivot table screenshot below and to the
right.)
Here are some other things you can do to the pivot table you just built. Try each of
these, hands-on. (Screenshots are not shown for all of these, but if you follow the
directions, you shouldn't have any problems with these modifications.)
1. The default layout for a pivot table (starting in Excel 2007) is called Compact
layout. You might prefer Tabular layout (the only layout in pre-2007 versions)
because it shows the names of the fields in the row and column areas. Both layouts
are shown in the screenshots to the right. You can change the layout through the
Report Layout dropdown on the PivotTable Tools Design ribbon.
2. By default, the sums are for all categories of any variables in the Filters area. To
show sums for VISA sales only, say, click the dropdown arrow next to Paid With and
select VISA.
3. You can hide any row or column categories. For example, click the Column Labels
dropdown list and select only Midwest and West.
4. You can change the way Total Cost is summarized and the way its values are
formatted. To do so, right-click any number in the pivot table and select a
summarizing function from the Summarize Values By dropdown list. For example,
select Average. Then right-click again and select Number Format and choose a
number format in the usual way. Now you see the average of Total Cost for the
various categories. (As an alternative, you can right-click and select Value Field
Settings. This opens a dialog box where you can make several changes at once.)
5. In the bottom section of the Fields pane, drag Gender to the Columns area and
Region to the Rows area. This is called pivoting. In fact, this is why they are called
pivot tables!
6. In the bottom section of the Fields pane, drag any of the fields to a blank space
on the worksheet, or simply uncheck its box in the top section. This removes the
field from the pivot table. There is no requirement that each of the four areas must
contain a field.
7. You can have two or more fields in a given area. For example, drag both Region
and Time to the Rows area. It starts to get "busy," but you are certainly allowed to
do it. Let's say you drag Gender to the Rows area and then you drag Time to the
Rows area. As you will see, the Gender button will be above the Time button in the
bottom section of the Fields pane, and Gender will be the "outer" field in the pivot
table. If you would rather reverse their roles, you can drag the Time button above
the Gender button in the bottom section of the Fields pane.
8. You can sort the values in the Rows or Columns areas through the dropdown
arrows, but the sort order might not be the natural order. For example, drag Time to
the Rows area (and drag any other variables off). The natural order is Morning,
Afternoon, Evening, but this isn't what you get with a sort. To sort appropriately,
select the Morning cell, and place your cursor at the bottom of the cell so that it
becomes a four-way arrow, and drag it up above Afternoon.
9. You can remove the grand totals from the rows and/or the columns. To do so,
right-click any number in the pivot table and select PivotTable Options. This leads to
a dialog box with many pivot table options, including the option to show or hide
grand totals.
arrows, but the sort order might not be the natural order. For example, drag Time to
the Rows area (and drag any other variables off). The natural order is Morning,
Afternoon, Evening, but this isn't what you get with a sort. To sort appropriately,
select the Morning cell, and place your cursor at the bottom of the cell so that it
becomes a four-way arrow, and drag it up above Afternoon.
9. You can remove the grand totals from the rows and/or the columns. To do so,
right-click any number in the pivot table and select PivotTable Options. This leads to
a dialog box with many pivot table options, including the option to show or hide
grand totals.
You can also summarize by counts. Then it doesn't matter which field is in the Values
area.
Try it! Start over by dragging everything off the pivot table. Now drag Gender to the
row area, Region to the column area, and any variable to the Values area.
If you drag a text variable to the Values area, you get counts by default. But if you
drag a numeric variable to the Values area, you will have to right-click in the pivot
table and select Count from the Summarize Values By list. (It's also a good idea to
change the title right above the pivot table to Count, rather than Count of Total Cost,
for example. The reason is that Total Cost, or whichever variable is in the Values
area, has nothing to do with the counts, so the default label is misleading.)
Each count shows the number of customers in the category. For example, you
should see that there are 43 females from the Midwest. (Examples appear in the
screenshots to the right).
You can experiment with the other Show Values As options. It all depends on how
you want to "tell the story."
Excel 2010 introduced a new feature for pivot tables called a slicer. See the Slicer topic in
this tutorial for more information about this feature. Then add one or more slicers to your
Slicers (introduced in Excel 2010)
Excel 2010 introduced a new feature for pivot tables called a slicer. See the Slicer topic in
this tutorial for more information about this feature. Then add one or more slicers to your
pivot table.
Note: Starting in Excel 2016, there is a multi-select button at the top of a slicer. This is for
touch devices. When you click it, you can then select multiple items using touch input.
Excel 2013 introduced a new Recommended PivotTables button on the Insert ribbon. If you
select a cell in your data set and then click this button, Excel recommends the pivot tables
you might want. If nothing else, this at least gets you started.
PivotTable button on Insert ribbon