Pivot tables offer a lot of flexibility in viewing data. Each column and row can be filtered to show a more specific view of the data.
Let's begin by building a pivot table that answers the question, "What were the sales for each region?" We'll then add a filter that will let us see sales for individual states.
To return to the Sales worksheet, if necessary,
Click the Sales worksheet tab
To move to the Insert tab, on the ribbon,
Click the Insert tab
To begin creating a pivot table, on the left side of the ribbon,
Click
To place the pivot table in a new worksheet, in the PivotTable from table or range dialog box,
Click
To select the current worksheet name, at the bottom of the Excel window,
Double-Click Sheet 2 tab
NOTE: The worksheet may have a different number.
To rename the worksheet, type:
RegionalSales Enter key
With the new worksheet created and named, we're ready to add fields to the pivot table.
To add the Region field to the Rows area,
Press & Drag the Region field to the Rows area
To add the Gross Sales field to the Values area,
Press & Drag the Gross Sales field to the Values area
This pivot table is small and basic. But it answers the question we asked of our data, "What were the sales for each region?" Before going any further with this pivot table, let's format the values to show as currency.
To open the Value Field Settings dialog box, in the Values area,
In Microsoft Excel for Windows, Click Sum of Gross Sales, Click Value Field Settings... In Microsoft Excel for macOS, Right-Click Sum of Gross Sales, Click Field Settings
To open the Format Cells dialog box, in the Value Field Settings dialog box,
In Microsoft Excel for Windows, Click In Microsoft Excel for macOS, Click
To see the currency options, in the Format Cells dialog box,
Click Currency
To reduce the number of decimal places, in the Decimal places area,
Double-Click 2, type: 0
To accept these changes, in the Format Cells dialog box,
Click
Before we close the Value Field Settings dialog box, let's create a custom name to replace Sum of Gross Sales.
To select the current name of the value field, in the Custom Name area,
Press & Drag Sum of Gross Sales
To remove the current name, on the keyboard, press:
Delete key
To rename the value field, type:
Total Sales
To accept the change and close the dialog box,
Click
Adding a filter to a pivot table
Now that the pivot table has been created and formatted, we're ready to add a filter. Pivot tables can be filtered in two ways: Using the drop-down menu next to the row or column headers or adding a field to the Filters area. Multiple filters can be applied at the same time.
To begin, let's add the State field to the Filters area. This will allow us to see the data related to specific states.
To add the State field to the Filters area, in the PivotTables Fields list,
Press & Drag the State field to the Filters area
The State field filter appears above the pivot table.
We can use the drop-down menu to select the specific states we wish to see.
To see the list of states,
Click
To filter the pivot table to see only the sales for California (CA), in the filter pop-up,
In Microsoft Excel for Windows, Click CA, Click In Microsoft Excel for macOS, Click the (Select All) checkbox, Click the CA checkbox
The pivot table adjusts and now shows a single value, $9,460,359. The row is labeled Pacific because that's the region that contains California.
The filter above the pivot table now shows the abbreviation for California, CA. The drop-down menu has also changed. It now shows a small funnel. This is a visual indicator that the pivot table has been filtered.
NOTE: In Microsoft Excel for macOS, the filter pop-up remains open.
Before we move on, let's remove that filter and see all of the sales totals again.
To remove the filter,
Click , Click (All), Click
To remove the filter, in the filter,
Click (Select All)
To close the filter, in the upper left corner of the filter pop-up,
Click
The filter is removed and all of the total sales are visible in the pivot table.
Filtering a pivot table using multiple criteria
There may be other questions we want this data to answer. How much of the total sales is each sales representative responsible for? Which sales representatives in the Southwest region had more than $2,000,000 in sales? We'll add some fields to our pivot table and use filters to get the data we need.
To add the Sales Rep field to the Rows area,
Press & Drag the Sales Rep field to the Rows area underneath the Region field
To move to the Design tab, on the ribbon,
Click the Design tab
To change the layout,
Click , Click Show in Outline Form
The pivot table shows the sales representatives and the sales each person produced. While the total sales for each region remain, using Outline Form moved these totals to the top of each region.
With the pivot table set up and containing the data we need, let's use filters to find specific facts.
To see the sorting and filtering options, in the pivot table,
Click
The sorting and filtering options appear:
These options allow us to sort the pivot table alphabetically in ascending (A to Z) or descending (Z to A) order by the Region field. We can also filter by labels or values. The bottom of the menu gives us checkboxes to show or hide a region from the pivot table.
We want to see only the Southwest region. To do this, we'll hide the Central and Pacific regions.
To deselect all of the regions,
Click the (Select All) checkbox
To select the Southwest region,
Click the Southwest checkbox
To accept this filter and close the options,
In Microsoft Excel for Windows, Click In Microsoft Excel for macOS, Click
Filtering by value
With the pivot table filtered to show only the data from the Southwest region, let's use another filter to see which sales representatives had more than $2,000,000 in sales. To accomplish this, we will use a Value Filter. This type of filter will allow us to filter the data based on numeric values.
NOTE: While the processes are similar, there are some differences in how value filters work in Microsoft Excel for Windows and Microsoft Excel for macOS. These differences are explained in the following steps.
To see the sorting and filtering options, in the pivot table,
Click
To view the Value Filters options, in the sorting and filtering options menu,
Point Value Filters
The Value Filters options appear:
To ensure that the pivot table is being filtered by the Total Sales,
Click , Click Total Sales
To view the Values Filters options, in the sorting and filtering options menu,
Click
The Value Filters options appear:
We can use these options to filter the pivot table to show data equal or not equal to a specific number, greater than or less than a value, between or not between two values, or even the top ten values.
To open the Value Filter dialog box, in the Value Filter options,
Click Greater Than...
The Value Filter (Sales Rep) dialog box opens:
In this dialog box, we can choose which field to filter by and how to filter it. The current entries are correct. We want to sort by the Total Sales field and show values that are greater than. The third area of the dialog box is where we put the value we want to compare, 2,000,000.
To filter the Total Sales field, in the blank area of the Value Filter (Sales Reps) dialog box, type:
2,000,000 Enter key
To begin filtering by values greater than a specified amount, in the Value Filters options,
Click Greater Than
To filter the pivot table by a value, in the blank field to the right of Greater Than, type:
2,000,000
To close the filter options,
Click
The pivot table now shows the Sales Reps in the Southwest region who had more than $2,000,000 in Total Sales.
To remove the Region filter,
Click , Click the (Select All) checkbox, Click
To remove the value filter from the Sales Rep field,
In Microsoft Excel for Windows, Click , Click Clear Filter From "Sales Rep" In Microsoft Excel for macOS, Click , Click , Click
Now that we've explored various types of filters, let's see how using slicers can make filtering data even easier.
Filtering a pivot table using slicers
Slicers are tools that add a visual element to the filtering process. Using slicers to filter data can make the process faster, especially if the data needs to be filtered often and by different criteria. With a slicer, it is easy to see how the data is being filtered.
Let's add slicers for the Region and State fields.
To open the Insert Slicers dialog box, on the PivotTable Analyze tab of the ribbon,
Click
The Insert Slicers dialog box opens:
The possible slicers match the fields of the pivot table. We will choose the Region and State slicers.
To select the Region slicer, in the Insert Slicer dialog box,
Click the Region checkbox
To select the State slicer, in the Insert Slicer dialog box,
Click the State checkbox
To insert these slicers, in the Insert Slicer dialog box,
Click
The slicers appear as objects in the worksheet. They may be overlapping and need to be rearranged. Because the slicers are outside the pivot table area, the field list has disappeared.
Let's move the slicers to the right of the pivot table.
To move the Region slicer,
Press & drag the Region slicer to the right of the pivot table
To move the State slicer,
Press & drag the State slicer to the right of the pivot table
The slicers should look similar to this:
The Region slicer has "buttons" for each of the three regions: Central, Pacific, and Southwest. The State slicer has "buttons" for all of the states included in the Sales worksheet.
To filter the pivot table to show the Pacific region, in the Region slicer,
Click
The pivot table adjusts and now shows only the sales representatives and total sales for the Pacific region. The slicers have also changed.
In the Region slicer, the Pacific button is selected. In the upper right corner, the small funnel icon indicates that the pivot table is filtered by this field. In the State slicer, the states within the Pacific region are selected. The states not in this region are grayed out.
We can use the State slicer to filter the pivot table even more.
To filter the pivot table to show the data for Oregon, in the State slicer,
Click
The pivot table now shows the one sales representative in Oregon and the Pacific region.
When the slicers are no longer useful, they can be easily removed. The pivot table will not be affected by the loss of the slicers.
To select the Region slicer,
Click in a blank area of the Region slicer
To remove the Region slicer, on the keyboard, press:
Delete key
To select the State slicer,
Click in a blank area of the State slicer
To remove the State slicer, on the keyboard, press:
Delete key
The pivot table remains filtered by Region and State.