Pivotdrill

Pivotdrill / Cheat sheet

Pivot table cheat sheet

Everything a pivot table can do, in the order you meet it: build, summarize, group, filter, show as a percent, calculate, lay out, refresh, and fix. Written for Excel for Windows with the Mac and Google Sheets differences noted, with a drill for most entries. Print the page or get the PDF by email.

No newsletter spam: the PDF, one follow-up with the free exercises, and nothing else unless you ask.

The ones worth learning first

WhatHow
Build oneClick in the data, Insert > PivotTable (Alt, N, V), New worksheet
Sum by categoryDrag the category to Rows, the amount to Values
Count instead of sumValues > Value Field Settings > Count (text fields count by default)
Grid of two dimensionsOne field to Rows, another to Columns, the amount to Values
By monthDate field to Rows; right-click > Group > Months (and Years)
Percent of totalRight-click the value > Show Values As > % of Grand Total
Sort largest firstRight-click a value > Sort > Largest to Smallest
Filter the whole tableField to Filters, or Insert > Slicer
Refresh after the data changesAlt+F5 (one table), Ctrl+Alt+F5 (all)
Make the source a Table firstCtrl+T on the data, so new rows are picked up on refresh

Build and summarize

Insert a pivot tableAlt, N, V (Windows). Mac: Insert > PivotTable. Sheets: Insert > Pivot table.
Source as a TableCtrl+T first; the pivot then grows with the data on refresh.
Revenue by regionRows: Region. Values: Sum of Revenue. drill
Orders per productRows: Product. Values: Count of Order ID. drill
Average by departmentValues > Value Field Settings > Average drill
Region by product gridRows: Region. Columns: Product. Values: Sum. drill
Max per groupValue Field Settings > Max drill
Min per groupValue Field Settings > Min drill
Two values side by sideDrag two fields to Values (Units and Revenue) drill
Count, total and average of one fieldDrag the same field to Values three times, set each summary drill
Nested rowsRows: Region, then Rep (order in the Rows box is the nesting) drill
Rows and columns both nestedRows: Department. Columns: Level. drill
Three dimensionsRows: Channel, Customer type. Values: Fees. drill
Distinct countAdd to Data Model when creating; Value Field Settings > Distinct Count
Rename a value headerType over the header cell, e.g. 'Revenue' (cannot equal the field name)

Sort and filter

Sort by a valueRight-click a value > Sort > Largest to Smallest drill
Smallest firstSort > Smallest to Largest drill
Report filterDrag Status to Filters, pick Approved drill
Exclude an itemRow label dropdown, untick the item (Remote) drill
Two filtersFilters: Priority = High and Status = Open drill
SlicerPivotTable Analyze > Insert Slicer; connect to several pivots with Report Connections
TimelineInsert Timeline for a date field; drag the range
Top 10Row label dropdown > Value Filters > Top 10
Label filterValue Filters / Label Filters > contains, begins with, greater than
Keep sort after refreshSort via the dropdown > More Sort Options, not by manual drag
Search a long listType in the search box of the row label dropdown

Dates and grouping

By monthRight-click a date > Group > Months drill
By quarterGroup > Quarters (and Years so quarters of different years do not merge) drill
Year over yearRows: Department. Columns: Years. drill
Tickets per monthRows: Created (grouped by month). Values: Count. drill
One quarter onlyGroup by quarters, then filter the column to Q4 drill
UngroupRight-click > Ungroup
Number binsRight-click a number row label > Group > start, end, by (e.g. 0 to 1000 by 100)
Custom groupsSelect several row items > right-click > Group, then rename Group1
Automatic date groupingFile > Options > Data > turn off if you prefer raw dates
Dates not groupingThe column holds text, not dates: convert with DATEVALUE or Text to Columns, then refresh

Show values as

% of grand totalShow Values As > % of Grand Total drill
% of rowShow Values As > % of Row Total (mix inside each region) drill
% of columnShow Values As > % of Column Total drill
% of parent% of Parent Row Total (share within the group above) drill
Difference fromShow Values As > Difference From > previous (year over year change)
% difference fromShow Values As > % Difference From > previous
Running totalShow Values As > Running Total In > Month
RankShow Values As > Rank Largest to Smallest
IndexShow Values As > Index (relative importance of a cell)
Same field twiceAdd the field to Values again and set one copy to a Show Values As

Calculations

Calculated fieldPivotTable Analyze > Fields, Items & Sets > Calculated Field: = Revenue * 0.05 drill
Ratio of two fieldsCalculated field = Profit / Revenue (computed on sums, which is what you want)
Average that is not an average of averagesCalculated field = Revenue / Units, not Average of Unit Price
Calculated itemFields, Items & Sets > Calculated Item (a new row item from others, e.g. East + West)
Budget vs actualColumns: Type (Budget, Actual). Add Difference From or a calculated field. drill
Resolution time by priorityAdd a helper column in the source (= Closed - Opened), then Average drill
Share by location% of Column Total on Headcount drill
Returning customersRows: Customer type. Values: Average order value (calculated field) drill
Country by yearRows: Country. Columns: Year (grouped). Values: Sum. drill
Measures (Data Model)Add to Data Model, then PivotTable Analyze > Measures: DAX like =DIVIDE(SUM(Sales[Profit]), SUM(Sales[Revenue]))
GETPIVOTDATA=GETPIVOTDATA("Revenue", $A$3, "Region", "East") pulls one cell for a report
Turn GETPIVOTDATA offPivotTable Analyze > Options > Generate GetPivotData

Layout and format

Tabular layoutDesign > Report Layout > Show in Tabular Form (one column per field)
Repeat labelsDesign > Report Layout > Repeat All Item Labels (for copying out)
Subtotals and grand totalsDesign > Subtotals / Grand Totals
Blank rows between groupsDesign > Blank Rows
Number formatValue Field Settings > Number Format (sticks after refresh, unlike cell formatting)
Show empty cells as 0PivotTable Options > For empty cells show: 0
Keep column widthsPivotTable Options > Layout > untick Autofit column widths on update
Collapse and expandClick the +/- buttons; right-click > Expand/Collapse Entire Field
Hide the +/- buttonsPivotTable Analyze > +/- Buttons
Pivot chartPivotTable Analyze > PivotChart
Conditional formattingHome > Conditional Formatting, apply to 'all cells showing Sum of Revenue values'

Refresh, source and fixes

RefreshAlt+F5; Refresh All: Ctrl+Alt+F5
Refresh on openPivotTable Options > Data > Refresh data when opening the file
Change the sourcePivotTable Analyze > Change Data Source
New rows missingSource range is fixed: make the source a Table (Ctrl+T) or extend the range
Sum shows as countThe column has text or blanks: clean the source (VALUE, remove blanks), then refresh and set Sum
Old items still in the dropdownPivotTable Options > Data > Number of items to retain per field: None, then refresh
Field list disappearedPivotTable Analyze > Field List
Overlapping pivots errorTwo pivots on one sheet grew into each other: move one or put each on its own sheet
Dates in text formConvert in the source, refresh, then group
Duplicate rows for the same itemTrailing spaces or different case in the source: TRIM and PROPER, refresh
Copy the values outSelect the pivot, Ctrl+C, Paste Special Values; use Tabular Form with repeated labels first

Shortcuts (Windows)

Insert pivot tableAlt, N, V
Refresh / Refresh AllAlt+F5 / Ctrl+Alt+F5
Select the whole pivotCtrl+A inside it
Group selected itemsAlt+Shift+Right arrow
UngroupAlt+Shift+Left arrow
Field settingsAlt+Enter on a field cell (or right-click)
Hide a selected itemCtrl+-
Toggle the field listAlt, JT, L
Google SheetsInsert > Pivot table; Values > Show as; dates group via Create pivot date group

pivotdrill.com: practice every one of these with instant checking. 89 entries.

Questions

Why does my pivot show Count instead of Sum?

At least one cell in that column is text or blank, so Excel defaults to Count. Clean the source column (convert text numbers with VALUE, fill or remove blanks), refresh, and set the summary to Sum.

Why does the pivot not include my new rows?

The data source is a fixed range. Turn the source into a Table with Ctrl+T, point the pivot at the Table name, and every refresh picks up new rows.

Average of averages is wrong. Why?

Averaging a column of unit prices weights every row the same. Make a calculated field that divides the sum of revenue by the sum of units, so the ratio is computed on totals.

Pivot table or formulas?

A pivot for exploring and for one-off summaries: it is faster and does not break. Formulas (SUMIFS, COUNTIFS) for a report that other formulas depend on, since pivots only update on refresh.

A cheat sheet does not make them stick

Doing them with instant checking does. The free exercises need no account.

Start practicing