Excel 2013: PivotTables

Lesson 27: PivotTables

/en/excel2013/conditional-formatting/content/

Introduction

When you have a lot of data, it can sometimes be difficult to analyze all of the information in your worksheet. PivotTables can help make your worksheets more manageable by summarizing data and allowing you to manipulate it in different ways.


Optional: Download our practice workbook.

Using PivotTables to answer questions

Let's say we wanted to answer the question: What is the amount sold by each salesperson? for the sales data in the example below. Answering this question could be time consuming and difficult—each salesperson appears on multiple rows, and we would need to total all of their different orders individually. We could use the Subtotal command to help find the total for each salesperson, but we would still have a lot of data to work with.

Screenshot of Excel 2013A worksheet containing sales data

Fortunately, a PivotTable can instantly calculate and summarize the data in a way that's both easy to read and manipulate. When we're done, the PivotTable will look something like this:

Screenshot of Excel 2013A completed PivotTable

Once you've created a PivotTable, you can use it to answer different questions by rearranging—or pivoting—the data. For example, if we wanted to answer the question: What is the total amount sold in each month? we could modify our PivotTable to look like this:

Screenshot of Excel 2013Pivoting data to answer different questions

To create a PivotTable:

  1. Select the table or cells (including column headers) containing the data you want to use.
    Screenshot of Excel 2013Selecting cells for a PivotTable
  2. From the Insert tab, click the PivotTable command.
    Screenshot of Excel 2013Clicking the PivotTable command
  3. The Create PivotTable dialog box will appear. Choose your settings, then click OK. In our example, we'll use Table1 as our source data and place the PivotTable on a new worksheet.


    Screenshot of Excel 2013Creating a PivotTable
  4. A blank PivotTable and Field List will appear on a new worksheet.
    Screenshot of Excel 2013A blank PivotTable on its own worksheet
  5. Once you create a PivotTable, you'll need to decide which fields to add. Each field is simply a column header from the source data. In the PivotTable Field List, check the box for each field you want to add. In our example, we want to know the total amount sold by each salesperson, so we'll check the Salesperson and Order Amount fields.
    Screenshot of Excel 2013Checking the desired fields
  6. The selected fields will be added to one of the four areas below the Field List. In our example, the Salesperson field has been added to the Rows area, while the Order Amount has been added to the Values area. Alternatively, you can click, hold, and drag a field to the desired area.


    Screenshot of Excel 2013Adding fields to the PivotTable
  7. The PivotTable will calculate and summarize the selected fields. In our example, the PivotTable shows the amount sold by each salesperson.
    Screenshot of Excel 2013The PivotTable calculating the selecting fields

Just like with normal spreadsheet data, you can sort the data in a PivotTable using the Sort & Filter command in the Home tab. You can also apply any type of number formatting you want. For example, you may want to change the Number Format to Currency. However, be aware that some types of formatting may disappear when you modify the PivotTable.

Screenshot of Excel 2013A sorted and formatted PivotTable

If you change any of the data in your source worksheet, the PivotTable will not update automatically. To manually update it, select the PivotTable and then go to Analyze > Refresh.

Pivoting data

One of the best things about PivotTables is that they can quickly pivot—or reorganize—data, allowing you to look at your worksheet data in different ways. Pivoting data can help you answer different questions and even experiment with the data to discover new trends and patterns.

In our example, we used the PivotTable to answer the question: What is the total amount sold by each salesperson? But now we'd like to answer a new question: What is the total amount sold in each month? We can do this by simply changing the field in the Rows area.

To change the row:

  1. Click, hold, and drag any existing fields out of the Rows area. The field will disappear.


    Screenshot of Excel 2013Removing a field
  2. Drag a new field from the Field List into the Rows area. In our example, we'll use the Month field.


    Screenshot of Excel 2013Adding a field
  3. The PivotTable will adjust—or pivot—to show the new data. In our example, it now shows the total order amount for each month.
    Screenshot of Excel 2013The updated PivotTable

To add columns:

So far, our PivotTable has only shown one column of data at a time. In order to show multiple columns, you'll need to add a field to the Columns area.

  1. Drag a field from the Field List into the Columns area. In our example, we'll use the Region field.
    Screenshot of Excel 2013Adding a field to the Column area
  2. The PivotTable will include multiple columns. In our example, there is now a column for each region.
    Screenshot of Excel 2013The PivotTable with columns

Filters

Sometimes you may want focus on just a certain section of your data. Filters can be used to narrow down the data in your PivotTable, allowing you to view only the information you need.

To add a filter:

In our example, we'll filter out certain salespeople to determine how they affect the total sales.

  1. Drag a field from the Field List to the Filters area. In this example, we'll use the Salesperson field.
    Screenshot of Excel 2013Adding a field to the Filters area
  2. The filter will appear above the PivotTable. Click the drop-down arrow, then check the box next to Select Multiple Items.
    Screenshot of Excel 2013Checking the box for Select Multiple Items
  3. Uncheck the box for any items you don't want to include in the PivotTable. In our example, we'll uncheck the boxes for a few different salespeople, then click OK.
    Screenshot of Excel 2013Choosing data to filter and clicking OK
  4. The PivotTable will adjust to reflect the changes.
    Screenshot of Excel 2013The updated PivotTable

Slicers

Slicers make filtering data in PivotTables even easier. Slicers are basically just filters, but they're easier and faster to use, allowing you to instantly pivot your data. If you frequently filter your PivotTables, you may want to consider using slicers instead of filters.

To add a slicer:

  1. Select any cell in the PivotTable.
  2. From the Analyze tab, click the Insert Slicer command.
    Screenshot of Excel 2013Clicking the Insert Slicer command
  3. A dialog box will appear. Select the desired field. In our example, we'll select Salesperson, then click OK.
    Screenshot of Excel 2013Choosing a field and clicking OK
  4. The slicer will appear next to the PivotTable. Each selected item will be highlighted in blue. In the example below, the slicer contains a list of all salespeople, and six of them are currently selected.
    Screenshot of Excel 2013The inserted slicer
  5. Just like filters, only selected items are used in the PivotTable. When you select or deselect items, the PivotTable will instantly reflect the changes. Try selecting different items to see how they affect the PivotTable. Press and hold the Ctrl key on your keyboard to select multiple items from a slicer.
    Screenshot of Excel 2013Selecting items from the slicer

You can also click the Filter icon in the top-right corner to select all items from the slicer at once.

PivotCharts

PivotCharts are like regular charts, except they display data from a PivotTable. Just like regular charts, you'll be able to select a chart type, layout, and style that will best represent the data.

To create a PivotChart:

In this example, our PivotTable is showing each person's total sales per month. We'll use a PivotChart so we can see the information more clearly.

  1. Select any cell in your PivotTable.
    Screenshot of Excel 2013Clicking a cell in the PivotTable
  2. From the Insert tab, click the PivotChart command.
    Screenshot of Excel 2013Clicking the PivotChart command
  3. The Insert Chart dialog box will appear. Select the desired chart type and layout, then click OK.


    Screenshot of Excel 2013Choosing a chart type and clicking OK
  4. The PivotChart will appear.
    Screenshot of Excel 2013The inserted PivotChart

Try using slicers or filters to change the data that is displayed. The PivotChart will automatically adjust to show the new data.

Screenshot of Excel 2013Manipulating a PivotChart

Challenge!

  1. Open an existing Excel workbook. If you want, you can use our practice workbook.
  2. Create a PivotTable using the data in the workbook.
  3. Experiment by placing different fields in the rows and columns areas.
  4. Filter the report with a slicer.
  5. Create a PivotChart.
  6. If you are using the example, use the PivotTable to answer the question, Which salesperson sold the lowest amount in January? Hint: First decide which fields you need in order to answer the question.

/en/excel2013/whatif-analysis/content/