Pivot Tables: Insert A Pivot Table

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 27

Pivot Tables

Pivot tables are one of Excel's most powerful features. A pivot table allows you to extract the
significance from a large, detailed data set.
Our data set consists of 213 records and 6 fields. Order ID, Product, Category, Amount, Date
and Country.

Insert a Pivot Table


To insert a pivot table, execute the following steps.
1. Click any single cell inside the data set.

2. On the Insert tab, in the Tables group, click PivotTable.

The following dialog box appears. Excel automatically selects the data for you. The default
location for a new pivot table is New Worksheet.
3. Click OK.

Drag fields
The PivotTable Fields pane appears. To get the total amount exported of each product, drag
the following fields to the different areas.
1. Product field to the Rows area.

2. Amount field to the Values area.

3. Country field to the Filters area.


Below you can find the pivot table. Bananas are our main export product. That's how easy
pivot tables can be!
Sort
To get Banana at the top of the list, sort the pivot table.

1. Click any cell inside the Sum of Amount column.

2. Right click and click on Sort, Sort Largest to Smallest.

Result.

Filter
Because we added the Country field to the Filters area, we can filter this pivot table by
Country. For example, which products do we export the most to France?
1. Click the filter drop-down and select France.

Result. Apples are our main export product to France.

Note: you can use the standard filter (triangle next to Row Labels) to only show the amounts
of specific products.

Change Summary Calculation


By default, Excel summarizes your data by either summing or counting the items. To
change the type of calculation that you want to use, execute the following steps.

1. Click any cell inside the Sum of Amount column.

2. Right click and click on Value Field Settings.


3. Choose the type of calculation you want to use. For example, click Count.

4. Click OK.

Result. 16 out of the 28 orders to France were 'Apple' orders.

Two-dimensional Pivot Table


If you drag a field to the Rows area and Columns area, you can create a two-dimensional
pivot table. First, insert a pivot table. Next, to get the total amount exported to each country,
of each product, drag the following fields to the different areas.
1. Country field to the Rows area.
2. Product field to the Columns area.

3. Amount field to the Values area.

4. Category field to the Filters area.

Below you can find the two-dimensional pivot table.


To easily compare these numbers, create a pivot chart and apply a filter. Maybe this is one
step too far for you at this stage, but it shows you one of the many other powerful pivot
table features Excel has to offer.
Group Pivot Table Items
This example teaches you how to group pivot table items. Learn how to group products and
how to group dates by quarters.
Below you can find a pivot table. Go back to Pivot Tables to learn how to create this pivot
table.

  Group Products
The Product field contains 7 items. Apple, Banana, Beans, Broccoli, Carrots, Mango and
Orange.

To create two groups, execute the following steps.

1. In the pivot table, select Apple and Banana.

2. Right click and click on Group.


3. In the pivot table, select Beans, Broccoli, Carrots, Mango and Orange.

4. Right click and click on Group.


Result:

Note: to change the name of a group (Group1 or Group2), select the name, and edit the
name in the formula bar. To ungroup, select the group, right click and click on Ungroup.

5. To collapse the groups, click the minus signs.

Conclusion: Apple and Banana (Group1) have a higher total than all the other products
(Group2) together.

Group Dates
To create the pivot table below, instead of the Product field, add the Date field to the Rows
area. The Date field contains many items. 6-Jan, 7-Jan, 8-Jan, 10-Jan, 11-Jan, etc.
To group these dates by quarters, execute the following steps.

1. Click any cell inside the column with dates.

2. Right click and click on Group.


3. Select Quarters and click OK.

Note: also see the options to group by seconds, minutes, hours, etc.

Result:

Conclusion: Quarter 2 is the best quarter.

Multi-level Pivot Table


It's perfectly ok to drag more than one field to an area in a pivot table. We will look at an
example of multiple row fields, multiple value fields and multiple report filter fields.
Remember, our data set consists of 213 records and 6 fields. Order ID, Product, Category,
Amount, Date and Country.
Multiple Row Fields
First, insert a pivot table. Next, drag the following fields to the different areas.
1. Category field and Country field to the Rows area.

2. Amount field to the Values area.


Below you can find the multi-level pivot table.

Multiple Value Fields


First, insert a pivot table. Next, drag the following fields to the different areas.
1. Country field to the Rows area.

2. Amount field to the Values area (2x).


Note: if you drag the Amount field to the Values area for the second time, Excel also
populates the Columns area.

Pivot table:
3. Next, click any cell inside the Sum of Amount2 column.

4. Right click and click on Value Field Settings.

5. Enter Percentage for Custom Name.

6. On the Show Values As tab, select % of Grand Total.


7. Click OK.

Result:
Multiple Report Filter Fields
First, insert a pivot table. Next, drag the following fields to the different areas.
1. Order ID to the Rows area.

2. Amount field to the Values area.

3. Country field and Product field to the Filters area.

4. Next, select United Kingdom from the first filter drop-down and Broccoli from the second
filter drop-down.

The pivot table shows all the 'Broccoli' orders to the United Kingdom.
Frequency Distribution
Did you know that you can use pivot tables to easily create a frequency distribution in Excel?
You can also use the Analysis Toolpak to create a histogram.
Remember, our data set consists of 213 records and 6 fields. Order ID, Product, Category,
Amount, Date and Country.

First, insert a pivot table. Next, drag the following fields to the different areas.
1. Amount field to the Rows area.

2. Amount field (or any other field) to the Values area.


3. Click any cell inside the Sum of Amount column.

4. Right click and click on Value Field Settings.


5. Choose Count and click OK.
6. Next, click any cell inside the column with Row Labels.

7. Right click and click on Group.


8. Enter 1 for Starting at, 10000 for Ending at, and 1000 for By.

9. Click OK.
Result:

To easily compare these numbers, create a pivot chart.

10. Click any cell inside the pivot table.

11. On the Analyze tab, in the Tools group, click PivotChart.

The Insert Chart dialog box appears.


12. Click OK.

Result:

You might also like