Pivot Table
Pivot Table
Pivot Table
An Excel PivotTable is a tool to explore and summarize large amounts of data, analyze
related totals and present summary reports designed to:
For example, you may have hundreds of entries in your worksheet with sales figures of local
resellers:
One possible way to sum this long list of numbers by one or several conditions is to use
formulas as demonstrated in SUMIF and SUMIFS tutorials. However, if you want to compare
several facts about each figure, using a pivot table is a far more efficient way. In just a few
mouse clicks, you can get a resilient and easily customizable summary table that totals the
numbers by any field you want.
The screenshots above demonstrate just a few of many possible layouts. And the steps
below show how you can quickly create your own pivot table in all versions of Excel.
Using an Excel Table for the source data gives you a very nice benefit - your data range
becomes "dynamic". In this context, a dynamic range means that your table will
automatically expand and shrink as you add or remove entries, so won't have to worry that
your pivot table is missing the latest data.
Useful tips:
• Add unique, meaningful headings to your columns, they will turn into the field
names later.
• Make sure your source table contains no blank rows or columns, and no subtotals.
• To make it easier to maintain your table, you can name your source table by
switching to the Design tab and typing the name in the Table Name box the upper
right corner of your worksheet.
This will open the Create PivotTable window. Make sure the correct table or range of cells is
highlighted in the Table/Range field. Then choose the target location for your Excel pivot
table:
• Selecting New Worksheet will place a table in a new worksheet starting at cell A1.
• Selecting Existing Worksheet will place your table at the specified location in an
existing worksheet. In the Location box, click the Collapse Dialog button to
choose the first cell where you want to position your table.
Clicking OK creates a blank pivot table in the target location, which will look similar to this:
Useful tips:
• In most cases, it makse sense to place a pivot table in a separate worksheet, this is
especially recommended for beginners.
• If you are creating a pivot table from the data in another worksheet or workbook,
include the workbook and worksheet names using the following syntax
[workbook_name]sheet_name!range, for example, [Book1.xlsx]Sheet1!$A$1:$E$20.
Alternatively, you can click the Collapse Dialog button and select a table or
range of cells in another workbook using the mouse.
• It might be useful to create a pivot table and pivot chart at the same time. To do
this, in Excel 2019, 2016 and 2013, go to the Insert tab > Charts group, click the arrow
below the PivotChart button, and then click PivotChart & PivotTable. In Excel 2010 and
2007, click the arrow below PivotTable, and then click PivotChart.
• The Field Section contains the names of the fields that you can add to your table.
The filed names correspond to the column names of your source table.
• The Layout Section contains the Report Filter area, Column Labels, Row Labels area,
and the Values area. Here you can arrange and re-arrange the fields of your table.
The changes that you make in the PivotTable Field List are immediately reflected to your
table.
To add a field to the Layout section, select the check box next to the field name in
the Field section.
By default, Microsoft Excel adds the fields to the Layout section in the following way:
• Uncheck the box nest to the field's name in the Field section of the PivotTable pane.
• Right-click on the field in your pivot table, and then click "Remove Field_Name".
How to arrange pivot table fields
You can arrange the fields in the Layout section in three ways:
1. Drag and drop fields between the 4 areas of the Layout section using the mouse.
Alternatively, click and hold the field name in the Field section, and then drag it to
an area in the Layout section - this will remove the field from the current area in
the Layout section and place it in the new area.
2. Right-click the field name in the Field section, and then select the area where you
want to add it:
3. Click on the filed in the Layout section to select it. This will also display the
options available for that particular field.
4. Choose the function for the Values field (optional)
By default, Microsoft Excel uses the Sum function for numeric value fields that you place in
the Values area of the Field List. When you place non-numeric data (text, date, or Boolean) or
blank values in the Values area, the Count function is applied.
But of course, you can choose a different summary function if you want to. In Excel 2019,
2016 an 2013, right-click the value field you want to change, click Summarize Values
By, and choose the summary function you want.
In Excel 2010 and lower, the Summarize Values By option is also available on the ribbon -
on the Options tab, in the Calculations group.
Below you can see an example of the pivot table with the Average function:
The functions' names are mostly self-explanatory:
To get more specific functions, click Summarize Values By > More Options… You can find the
full list of available summary functions and their detailed descriptions here.
Tip. The Show Values As feature may prove especially useful if you add the same field more
than once and show, for example, total sales and sales as a percent of total at the same
time. See an example of such a table.
This is how you create pivot tables in Excel. And now it's time for you to experiment with the
fields a bit to choose the layout best suited for your data set.
If you want to change how the sections are displayed in the Field List, click the Tools button,
and choose your preferred layout.
You can also resize the pane horizontally by dragging the bar (splitter) that separates the
pane from the worksheet.
Closing the PivotTableField List is as easy as clicking the Close button (X) in the top right
corner of the pane.Making it to show up again is not so obvious :)
To display the Field List again, right-click anywhere in the table, and then select Show Field
List from the context menu.
You can also click the Field List button on the Ribbon, which resides on the Analyze /
Options tab, in the Show group.
3. In the Recommended PivotTables dialog box, click a layout to see its preview.
4. If you are happy with the preview, click the OK button, and get a pivot table
added to a new worksheet.
As you see in the screenshot above, Excel was able to suggest just a couple of basic layouts
for my source data, which are far inferior to the pivot tables we created manually a moment
ago. Of course, this is only my opinion and I am biased, you know : )
Overall, using the Recommended PivotTable is a quick way to get started, especially when
you have a lot of data and are not sure where to start.
You can also access options and features that are available for a specific element by right-
clicking on it.
How to design and improve pivot table
Once you have created a pivot table based on your source data, you may want to refine it
further to make powerful data analysis.
To improve the table's design, head over to the Design tab where you will find plenty of pre-
defined styles. To create your own style, click the More button in the PivotTable Styles gallery,
and then click "New PivotTable Style...".
To customize the layout of a certain field, click on that field, then click the Field
Settings button on the Analyze tab in Excel 2019, 2016 and 2013 (Options tab in Excel 2010
and 2007). Alternatively, you can right click the field and choose Field Settings from the
context menu.
The screenshot below demonstrate a new design and layout for our pivot table in Excel
2013.
An easy way to get rid of these ridiculous headings is to switch from the Compact layout to
Outline or Tabular. To do this, go to the Design ribbon tab, click the Report
Layout dropdown, and choose Show in Outline Form or Show in Tabular Form.
This will display the actual field names, as you see in the table on the right, which makes
much more sense.
Another solution is to go to the Analyze (Options) tab, click the Options button, switch to
the Display tab and uncheck the "Display Field Captions and Filter Dropdowns" box. However,
this will remove all field captions as well as filter dropdowns in your table.
Alternatively, you can right-click the table, and choose Refresh from the context
menu.
To refresh all pivot tables in your workbook, click the Refresh button arrow, and then
click Refresh All.
Note. If the format of your pivot table gets changed after refreshing, make sure the "Autofit
column width on update" and "Preserve cell formatting on update" options are selected. To
check this, click the Analyze (Options) tab > PivotTable group > Options button. In
the PivotTable Options dialog box, switch to the Layout & Format tab and you will find these
check boxes there.
After starting a refresh, you can review the status or cancel it if you've changed your mind.
Just click on the Refresh button arrow, and then click either Refresh Status or Cancel Refresh.
2. In the PivotTable Options dialog box, go to the Data tab, and select the Refresh
data when opening the file check box.
How to move a pivot table to a new location
If you want to move your table to a new workbook, worksheet are some other area in the
current sheet, head over to the Analyze tab (Options tab in Excel 2010 and earlier) and click
the Move PivotTable button in the Actions group. Select a new destination and click OK.
How to delete an Excel pivot table
If you no longer need a certain summary report, you can delete it in a number of ways.
• No Filter
• Rows: Product, Reseller
• Columns: Months
• Values: Sales
Pivot table example 2: Three-dimensional table
• Filter: Month
• Rows: Reseller
• Columns: Product
• Values: Sales
• No Filter
• Rows: Product, Reseller
• Values: SUM of Sales, % of Sales
This summary report shows total sales and sales as a percent of total at the same time.