Sub topic 9
Sorting and filtering results
This chapter assumes you can insert a PivotTable and place fields in the Rows, Columns and Values areas. It uses the sales data from earlier chapters: Date, Region, Product, Units and Sales. The PivotTable has Region in Rows, Product in Columns and Sum of Sales in Values.
Sorting
Sorting changes the order of items in a row or column field. It does not change the source data.
To sort, click the drop-down arrow on the Row Labels or Column Labels header. Choose Sort A to Z or Sort Z to A. To sort by a number, click any value in the column you want to rank. Then use Data > Sort Largest to Smallest. Excel sorts the row items by that column's values.
Sorting by value is the common case. If you want regions ranked by total sales, right-click a Sales total and choose Sort > Sort Largest to Smallest.
Filtering
Filtering hides items so the PivotTable shows only what you need. Excel offers four ways to filter.
| Method | Where to find it | Use it for |
|---|---|---|
| Item checkboxes | Drop-down arrow on a row or column header | Showing a few named items, such as East only |
| Label filters | Same drop-down, under Label Filters | Matching item names, such as names that begin with W |
| Value filters | Same drop-down, under Value Filters | Keeping items by total, such as regions above 300 |
| Report Filter | Fields dragged to the Filters area | Filtering the whole PivotTable by one field |
Using a report filter
Drag Date or Region into the Filters area. A drop-down appears above the PivotTable, usually in cells A1 and B1. Choose one item, or tick Select Multiple Items to pick several. The grid then shows only the matching records.
Using a Top 10 filter
A Top 10 filter keeps the highest or lowest items by a value. On the Row Labels drop-down, choose Value Filters > Top 10. Set Show to Top, enter 3, and choose Sum of Sales. Despite the name, you can enter any number.
Common problems
- A filtered-out item is hidden, not deleted. Grand Totals can exclude hidden items, so totals may look lower than the source total.
- A manual sort can be undone by a refresh. Open the field's Sort options and choose Sort automatically, or set a sort rule so new items land in the right place.
- A new item in the source data may not appear if a filter is active. Clear the filter and refresh.
To remove a filter, open the drop-down and choose Clear Filter From. To remove all filters, use PivotTable Analyze > Clear > Clear Filters.
Exercise
Your PivotTable lists regions in Rows with Sum of Sales in Values. You want to show only regions whose total sales exceed 300, ranked from highest to lowest. Which steps do you take?
Show answer
Open the Row Labels drop-down and choose Value Filters > Greater Than. Select Sum of Sales, enter 300, and click OK. Then right-click a Sales total and choose Sort > Sort Largest to Smallest.