Microsoft Excel Training

Creating PivotTables

Learn to create a PivotTable, arrange fields, summarize data with different calculations, format results, control totals, and filter the report with a slicer.

Start here

Overview

PivotTables summarize large data lists without requiring users to write formulas. This lesson builds a PivotTable from travel data and then modifies its fields, calculations, layout, and filters.

What You Will Learn

  • Create a PivotTable from an Excel data list.
  • Place fields in Rows, Columns, Values, and Filters areas.
  • Change the summary calculation from Sum to Average or another function.
  • Format PivotTable values appropriately.
  • Show or hide row and column grand totals.
  • Insert, use, resize, and remove a slicer.
  • Clear filters and save the PivotTable with the workbook.

Before You Begin

  • Excel data lists with field headings
  • Sorting and filtering concepts
  • Basic statistical summaries such as Sum and Average

Why This Matters

PivotTables let users explore and reorganize data quickly, making them one of Excel’s most powerful tools for business reporting and analysis.

Plan Your Study

  • Open the source workbook and activate a cell in the data list.
  • Create the PivotTable on a new worksheet.
  • Drag fields into the desired areas.
  • Change the summary calculation and number format.
  • Adjust totals and layout options.
  • Insert a slicer and use it to filter the report.

Next step

Read the complete chapter.

The Learn tab contains the written lesson from Surviving Statistics.

Go to Learn

Written lesson

Learn Creating PivotTables

Learn to create a PivotTable, arrange fields, summarize data with different calculations, format results, control totals, and filter the report with a slicer.

Advertisement

Creating PivotTables

PivotTables are a very versatile and flexible tool to quickly analyze and summarize data in an Excel worksheet. Pivot tables allow you to perform statistical analysis on large Excel databases without having to create any formulas on your own. PivotTables can quickly produce different computations according to your specifications. For example, with our No Fault Travel database, you can have the PivotTable compute the average trip cost to each destination; then, with just a couple of mouse clicks, the PivotTable could display the average cost of a 7-day trip.

▶
Watch the video-Creating and Using Pivot Tables Watch video

⬇
Downlaod Example File for pivot table Lesson Open or download

Creating PivotTables

In this lesson you will use a PivotTable to analyze the database we created for the No Fault Travel Agency.

1. Open the Trip Data workbook.

Microsoft Excel lesson screenshot PivotTable1

2. Move into the database. In the Tables group on the Insert tab, click the PivotTable tool.

Microsoft Excel lesson screenshot PivotTable2

In the Create PivotTable dialog box, you will specify the location of the source data. Since one of the database cells was active when you clicked the PivotTable tool, the database location appeared as the selected data range in the dialog box when it opened. In this dialog box, you will also specify the location for the PivotTable. We will place it in a new worksheet for the same reasons that we have placed charts on new worksheets.

3. In the Create PivotTable dialog box, be sure New Worksheet is selected. Click OK.

Microsoft Excel lesson screenshot PivotTable3

Excel has now created a new worksheet and named it Sheet2. This is a pivot table worksheet and, as of right now, displays no data.

The next steps will be to build the PivotTable by specifying the field containing the values to be used in the computations and the field containing the separate categories (i.e., the groups) that you want to see the computations for.

In the PivotTable Fields task pane, you may simply click a checkbox beside the field name; however, dragging the field to the desired task pane area will ensure that the PivotTable is designed exactly as you wish.

4. In the PivotTable task pane, drag Destination from the field list into the Columns area.

Microsoft Excel lesson screenshot PivotTable4

If you had clicked on the Destination rather than dragging it, Excel would have placed the destinations as row headings rather than column headings.

Now, each destination should appear as a column in the PivotTable. The destinations are really serving as the “groups” you created when you used the Subtotal command.

Excel will perform the calculations for each destination.

5. Drag Cost from the field list into the Values area in the PivotTable Fields task pane.

Because Excel recognizes the Cost field as a field it can perform calculations with, you would have simply clicked on its checkbox.

Microsoft Excel lesson screenshot PivotTable5

The trip cost for each destination should appear in the PivotTable, as well as the grand total for all trips. Be default, Excel uses the Sum function for fields in the Values section. When you dragged Destination to the Columns area in the task pane, Destination was added under Columns. However, when you dragged Cost to the Values area, Sum of Cost was added under Values. This allows you to see what computation Excel is performing on that field.

Changing the Function

If you would like to see the average trip cost to each destination, you can use the Average function instead of Sum in the PivotTable. You can change the computation performed from the Values area of the task pane, or by double-clicking on “Sum of Cost” in the PivotTable.

1. Double click on “Sum of Cost” in the 2nd row of the PivotTable (cell A5).

The Value Field Settings dialog box will allow you to choose from about a dozen computations (functions) which can be performed; you can also select number formatting for the result. From the Show Values as tab, you could choose to display the total trip cost for each destination as a percentage of the total cost for all trips.

Microsoft Excel lesson screenshot PivotTable6

2. Under Summarize value field by in the Value Field Settings dialog box, choose Average. Then click the Number Format button.

Microsoft Excel lesson screenshot PivotTable7

3. In the Format Cells dialog box, choose Currency format, with zero decimal places and then click OK. Click OK again to leave the Value Field Settings dialog box.

Microsoft Excel lesson screenshot PivotTable8

Notice that the PivotChart is now displaying the average trip cost for each destination, not the total cost. The “Grand Total” is really the “Overall Average” for all trips. Also notice that the numbers are formatted with dollar signs ($).

Modifying a PivotTable

After completing a PivotTable, you can still add, change, or remove fields. In the next steps, you will see how easy it is to modify a PivotTable.

1. Make sure the PivotTable is active. From the field list in the PivotTable Fields task pane, drag Length into the Row area.

Reminder: You can select (i.e., make active) any PivotTable, database, or named range by clicking in one of its cells.

Microsoft Excel lesson screenshot PivotTable9

The values from the Length field should appear under the heading “Row Labels” in the PivotTable, which displays the average cost for each trip length and every destination. If you wish to remove a specific destination or only include trips lasting so many days, you can apply a filter to the pivot table.

In this portion of the lesson you will explore using filters within PivotTables.

2. In the PivotTable, click the drop-down button in Column Labels.

The destinations are the column labels. The drop-box menu lets you select which destinations to display.

Microsoft Excel lesson screenshot PivotTable10

3. Turn off the checkbox for Jerusalem and Jamaica. Click OK.

All destinations except the two you de-selected are now shown in the PivotTable. Also notice that the averages have been recalculated. The “Grand Total” (really the overall average) is higher with the trips to Jamaica and Jerusalem removed.

Microsoft Excel lesson screenshot PivotTable11

4. Click the drop-down button in Column Labels. Select Clear Filter from “Destination.”

In the next step, you will remove the Length field from the PivotTable.

5. In the PivotTable Fields task pane, de-select (uncheck) Length in the field list.

The pivot table no longer displays the length of the trips.

Microsoft Excel lesson screenshot PivotTable12

Changing PivotTable Options

Microsoft Excel lesson screenshot PivotTable13

In this portion of the lesson you will learn to turn off the Grand Totaling feature. However, if you want to keep the overall average, you could edit the text in cell F4 from Grand total to Overall Average as shown. However, for this example, we will assume you do not want to display this column in the pivot table.

The PivotTable dialog box (shown on the next page) provides many advanced options, which include formatting, filtering, and selecting what is displayed on the PivotTable. For example, you may decide not to display the last column, “Grand Total,” since the caption is misleading when the table displays averages and not totals (i.e., sums). The PivotTable Tools Analyze tab provides access to some of the more advanced features available for PivotTables.

1. Display the Analyze tab on the ribbon and click the Options tool in the Pivot Table group.

Microsoft Excel lesson screenshot PivotTable14

You should now see the PivotTable Options dialog box.

Microsoft Excel lesson screenshot PivotTable15

2. In the PivotTable options dialog box, select the Totals & Filters tab. Under Grand Totals, de-select the Show grand totals for rows and also turn off Show grand totals for columns. Click OK.

This pivot table currently does not display grand totals for columns, but if you added another field to serve as row headers, the totals would appear for each column, unless you turned off that option too.

Microsoft Excel lesson screenshot PivotTable16

The PivotTable should no longer display the “grand total” for all destinations.

Using the Slicer

In this portion of the lesson, we will use the Slicer which is an easy way to filter PivotTable information with a single mouse click. In the next steps, you will add a Slicer for the Destination field to the PivotTable and then use it to choose which destinations appear on the PivotTable.

1. Ensure the PivotTable is active. In the Filter group on the PivotTable Tools Analyze tab, click the Insert Slicer tool.

Microsoft Excel lesson screenshot PivotTable17

The Insert Slicers dialog box should appear, and as the name implies, you can insert more than one slicer tool for the PivotTable.

Microsoft Excel lesson screenshot PivotTable18

2. On the Insert Slicers dialog box, turn on the Destination checkbox and click OK.

The title of the Slicer is the field (in our case, Destination) that you selected and the buttons on the Slicer are the values contained in that field. For our No Fault Travel database, the Destination slicer is the list of destinations for the booked trips. The Slicer is a filtering tool; the PivotTable will display the computation for the one or more destinations that you select.

Microsoft Excel lesson screenshot PivotTable19

3. If needed, move the slicer so the entire pivot table is visible, then, click London.

Microsoft Excel lesson screenshot PivotTable20

With just one click, you have “sliced” the records so that the PivotTable only shows the calculation for the destination you selected. Notice that the destination(s) for the shaded buttons appear on the PivotTable. You can use “Control+Click” to add multiple destinations.

4. Press and hold (Control), and then click on Maui.

Both the London and Maui locations should appear on the PivotTable now.

Microsoft Excel lesson screenshot PivotTable21

You could use the Clear Filter button in the top right corner of the slicer to remove the filter and to display all destinations. However, we will remove the filter directly from the PivotTable in the next steps.

5. If sizing handles are not visible on the slicer window frame, click somewhere in a blank area of the slicer.

Sizing handles, small white circles on the frame corners and midpoints, indicate that the slicer window is selected. You can grab any of the sizing handles to resize it. When the slicer window is selected, you can also move it by clicking in any blank area and dragging it. You might want to experiment with resizing and moving now.

6. Press (Delete).

You have removed the Slicer from the pivot table. Excel working environment, but you have not deleted the filter that you applied using the Slicer tool.

7. Click the Filters button on Column Labels in the PivotTable. Choose Clear Filter from “Destination.”

Microsoft Excel lesson screenshot PivotTable22

8. Return to sheet1, the data you used for this pivot table. Save and close the workbook.

The PivotTable is saved as a worksheet in this workbook.

Advertisement

Next step

See the concepts demonstrated.

Continue to Watch for chapter videos and worked examples.

Go to Watch

See it explained

Watch

Choose the explanation or example that best supports your learning.

Next step

Apply what you have learned.

Use the guided questions and activities in Practice.

Go to Practice

Apply what you learned

Practice Creating PivotTables

Create a PivotTable from the practice data, then modify the report to answer several business questions.

Guided Practice

  • Create the PivotTable on a new worksheet.
  • Place Destination in one report area and Cost in Values.
  • Change the calculation from Sum to Average.
  • Apply an appropriate currency number format.
  • Insert a Destination slicer and display selected destinations.

Challenge Yourself

  • Rearrange the fields to show a different perspective without rebuilding the PivotTable.
  • Add a second value field using a different summary function.
  • Turn grand totals off and compare the report.
  • Create a second slicer using another categorical field.

Check Your Understanding

  • Can you explain the purpose of each PivotTable field area?
  • Can you explain why a numerical field may default to Count instead of Sum?
  • Can you distinguish filtering with a field button from filtering with a slicer?

Next step

Save the materials you may need later.

Open Resources for the study sheet, spreadsheets, and related learning materials.

Go to Resources

Keep learning

Resources

Study sheets, downloadable files, companion tools, and related lessons for this chapter.

For educators

Teaching this chapter?

The Instructor tab contains objectives, teaching ideas, assessments, and a printable guide.

Open Instructor Resources

LutherMaddy.com — Helping Humans Learn

Creating PivotTables: Instructor Resources

Teach this lesson

Instructor Resources

Classroom-ready objectives, teaching ideas, questions, and assessment materials for this chapter.

Learning Objectives

  • Create a PivotTable from a correctly structured data list.
  • Arrange fields in Rows, Columns, Values, and Filters.
  • Change the summary calculation and value format.
  • Control grand totals and report layout.
  • Use a slicer to filter a PivotTable interactively.

Prerequisite Knowledge

  • Excel data lists
  • Field headings
  • Basic summary statistics

Teaching Outline

  • Review the source-data requirements.
  • Create the PivotTable on a new worksheet.
  • Build the first report by dragging fields.
  • Change the value calculation and formatting.
  • Modify totals and layout.
  • Add, use, and remove a slicer.

Key Concepts

  • PivotTables summarize source data without changing it.
  • Field placement determines the report’s perspective.
  • Value Field Settings controls the computation.
  • Slicers provide visible, button-based filters.
  • PivotTables are saved as worksheets in the workbook.

Classroom Demonstration

  • Move one field from Columns to Rows and show how the report changes immediately.
  • Change Sum to Average and discuss the different business question being answered.

Questions to Ask

  • Why are PivotTables more flexible than fixed subtotal reports?
  • Why might Excel summarize a numeric-looking field with Count?
  • What advantage does a slicer provide over a standard filter button?

Teaching Notes

  • Emphasize clean source data with one header row and no blank rows.
  • Demonstrate dragging rather than relying only on field checkboxes.
  • Require students to label and format values for readability.

Assessment Ideas

  • Create a PivotTable with specified row, column, and value fields.
  • Change the summary calculation and number format.
  • Use a slicer to display two selected categories.
  • Rearrange fields to answer a second question.

Grading Rubric

CriterionPoints
PivotTable created from correct source data2
Fields placed correctly2
Summary function and formatting correct2
Totals and layout configured correctly2
Slicer used and cleared correctly2
Total10

Exam and Discussion Questions

Basic

  • Name the four primary PivotTable field areas.

Applied

  • Create a PivotTable that shows average cost by destination.

Conceptual

  • Explain how rearranging fields changes the question answered by a PivotTable.

Keep Exploring

Continue Learning

Explore step-by-step lessons, interactive calculators, downloadable study sheets, and practical educational resources.