Tutorials

Pivot tables, explained once

A pivot table turns thousands of rows into a summary you can rearrange by dragging. What it does, how to build one, and the five settings that solve most pivot table problems.

TEPtThe ExcelToolkit Pro teamEditorial4 min read
Post on XLinkedIn
A pivot table summarising sales by region and month next to its field list

A pivot table summarises a long list (sales, expenses, survey answers) into a compact table of totals, counts or averages, and lets you rearrange that summary by dragging field names. No formulas required. If you just want a summary sheet without opening Excel, the Pivot Table Generator writes one from your file in the browser (as a static table rather than a live PivotTable).

What a pivot table does

Say you have 20,000 rows of sales, one per order: Date, Region, Product, Salesperson, Amount. You want total sales by region and month. You could write SUMIFS formulas for every combination. Or you can let a pivot table group the rows for you:

RegionJanFebMarTotal
North41,20038,95044,100124,250
South35,87040,02039,400115,290

Then drag Product to where Region was, and it becomes sales by product. That rearranging, "pivoting", is where the name comes from.

Step 1: get the data ready

Pivot tables are fussy about their source, and almost every problem traces back to it:

  • One header row, with a name in every column.
  • No blank rows or columns in the middle.
  • No totals or subtotals inside the data.
  • Numbers as numbers and dates as dates, not text. Text numbers are counted, not summed.

Best of all, turn the data into a table with Ctrl + T. A pivot table built on a table picks up new rows when you refresh, instead of stopping at the original range.

Step 2: insert the pivot table

  1. Click any cell in the data.
  2. Insert → PivotTable. Check the range or table name.
  3. Choose New Worksheet and press OK.

You get an empty pivot table on the left and the PivotTable Fields pane on the right, listing your columns.

Step 3: drag fields into the four areas

  • Rows: the categories down the side (Region).
  • Columns: categories across the top (Month). Optional.
  • Values: the numbers to summarise (Amount). Excel sums numbers and counts text by default.
  • Filters: a drop-down above the table to show one slice, such as one Salesperson.

Tick a field and Excel guesses an area; drag it to put it exactly where you want.

Five settings that solve most problems

1. Change Sum to Count or Average. Click the field in Values → Value Field Settings → choose the calculation. If the field shows "Count of Amount" when you wanted a sum, the column contains text or blanks: clean the source and refresh.

2. Show percentages. Value Field Settings → Show Values As → % of Grand Total, % of Column Total, or % Difference From the previous month.

3. Group dates. Put a date field in Rows; recent Excel versions group it into years, quarters and months automatically. To change the grouping, right-click a date → Group. If Group is greyed out, some "dates" in the column are actually text.

4. Refresh. A pivot table does not update when the source data changes. Right-click it → Refresh, or Data → Refresh All. To refresh on opening: PivotTable Analyze → Options → Data → Refresh data when opening the file.

5. Number format. Value Field Settings → Number Format formats the whole field, and the format survives refreshes and rearranging (formatting the cells directly does not).

Slicers: filters people can click

PivotTable Analyze → Insert Slicer adds buttons for a field such as Region. Click a button to filter; Ctrl + click for several. One slicer can drive several pivot tables (right-click it → Report Connections), which is the basis of most simple Excel dashboards.

Pivot table or formulas?

Use a pivot table to explore and to summarise by categories that change. Use SUMIFS when the summary has a fixed layout that must stay put, or feeds other calculations. Pivot tables move when they are refreshed, so formulas that point into them break easily; GETPIVOTDATA exists for that, but a SUMIFS on the source is often simpler. The SUMIF Generator writes those for you.

Common errors

  • "The PivotTable field name is not valid": a column in the source has no header.
  • Blank or "(blank)" rows: the source range includes empty rows. Use a table, or fix the range in PivotTable Analyze → Change Data Source.
  • Old items still in the filter list: PivotTable Options → Data → Number of items to retain per field → None, then refresh.

Clean source data prevents most of these. The Excel Data Cleaner trims spaces and converts text numbers before you pivot.

TEPt

The ExcelToolkit Pro team

Editorial

We build the browser-based tools on this site, and we write these guides from the problems that actually come through the contact form — broken lookups, workbooks that will not open, exports that arrive mangled. Everything here is tested against real files before it is published.

Get the next one by email

New guides every other Tuesday. Unsubscribe in one click.

No spam. Unsubscribe in one click.

Keep reading

The Visual Basic Editor in Excel showing a short commented macro
Tutorials4 min read

What is a macro in Excel, and how to enable one safely

A macro is a recorded or written set of steps Excel can repeat for you. Here is what that means in practice, how to run one, and how to tell whether it is safe to enable.

TEPtThe ExcelToolkit Pro teamEditorial
An Excel column chart of monthly sales beside the table it was built from
Tutorials4 min read

How to create charts in Excel (and pick the right one)

A chart takes about ten seconds to insert and much longer to get right. The steps, which chart fits which question, and the fixes for the problems everyone hits.

TEPtThe ExcelToolkit Pro teamEditorial