Nishaglobal Education logo

Summarising data with PivotTables

Summarise thousands of rows in a few clicks with PivotTables: totals by region, counts by product, months across columns, filters and slicers, then refresh when new data arrives.

Lesson 9 of 1240 minQuiz: 4 questions

🎯 By the end of this lesson you will be able to:

  • Create a PivotTable from a table of data
  • Arrange fields in Rows, Columns, Values and Filters to answer questions
  • Change the summary (sum, count, average), group dates and refresh
Outline
  1. What you'll learn and why it matters
  2. Create a PivotTable
  3. Total sales by region
  4. Rows and columns: a cross-table
  5. Changing what is shown
  6. Checking a PivotTable with formulas
  7. Practice
  8. Common mistakes
  9. Recap
  10. Quiz
  11. Mark lesson complete

What you'll learn and why it matters

A PivotTable summarises a big table without a single formula: *total sales by region*, *units of each product per month*, *number of orders per salesperson*. You drag fields around and the summary rearranges itself instantly. Analysts call it the most powerful feature in Excel, and it is the first thing many interviewers ask about.

Create a PivotTable

  1. Click any cell in the Sales data (ideally formatted as a table, lesson 8), after adding a Total column (=Units*Price, using XLOOKUP for the price as in lesson 6).
  2. Choose Insert β†’ PivotTable. Excel selects the whole table. Choose New worksheet and click OK.
  3. A blank PivotTable appears with the PivotTable Fields pane on the right, listing every column heading.

The pane has four boxes. Drag field names into them (or tick a field and let Excel choose):

BoxWhat it doesExample
RowsOne row in the summary per different valueRegion
ColumnsOne column per different valueMonth
ValuesThe numbers to summarise (Sum, Count, Average…)Total
FiltersShow only some dataSalesperson = Asha

Total sales by region

Drag Region to Rows, and Total to Values (it shows *Sum of Total*). Drag Order ID to Values as well: because it is text, Excel counts it (*Count of Order ID*). Here is the result for the practice workbook's 48 orders:

Worksheet: PivotTable

Sum of Total and Count of Order ID by region for all 48 orders in the practice workbook. The Grand Total row is added automatically.
RowABC
1Row LabelsSum of TotalCount of Order ID
2East16,19011
3North30,89013
4South14,8609
5West28,37015
6Grand Total90,31048
Sum of Total and Count of Order ID by region for all 48 orders in the practice workbook. The Grand Total row is added automatically.

That is a summary of 48 rows in about ten seconds, and it would be just as quick for 48,000.

Rows and columns: a cross-table

Put Product in Rows, Date in Columns and Units in Values. Excel groups the dates by month automatically (in Excel for the web, right-click a date and choose Group if it does not). For January to March:

Worksheet: PivotTable

Units sold per product per month, January to March, from the practice workbook.
RowABCDE
1Sum of UnitsJanFebMarGrand Total
2Notebook11171240
3Pen set125926
4Backpack2327
5Water bottle017320
6Desk lamp4004
7Sketchbook14111136
Units sold per product per month, January to March, from the practice workbook.

Changing what is shown

To…Do this
Show an average instead of a sumClick the field in Values β†’ Value Field Settings (or Summarize Values By) β†’ Average
Show percentages of the totalValue Field Settings β†’ Show Values As β†’ % of Grand Total
Sort largest firstRight-click a number in the column β†’ Sort β†’ Sort Largest to Smallest
Filter to one salespersonDrag Salesperson to Filters, then pick a name above the PivotTable
Click-to-filter buttonsInsert β†’ Slicer (desktop Excel and Microsoft 365) shows a button per value
See the rows behind a numberDouble-click the number (desktop Excel): a new sheet lists the matching orders

Checking a PivotTable with formulas

A good analyst double-checks important numbers. SUMIFS and COUNTIFS (lesson 5) give the same answers as a PivotTable, so you can check one against the other:

Worksheet: Check

For the first ten orders, SUMIFS and COUNTIFS rebuild a PivotTable by region. The totals in row 6 must equal the sum of all orders: 21,640 from 10 orders.
RowABCDEFGHIJ
1RegionSalespersonProductUnitsPriceTotalRegionSum of TotalCount
2WestAshaSketchbook113003300North88804
3NorthMeeraPen set42501000South13201
4WestRaviSketchbook3300900East32402
5NorthSaraNotebook91201080West82003
6EastRaviNotebook2120240Total2164010
7NorthMeeraPen set82502000
8EastMeeraBackpack215003000
9NorthAshaDesk lamp412004800
10SouthKofiNotebook111201320
11WestRaviWater bottle104004000

Formulas (green cells)

  • F2 =D2*E2 β†’ 3300
  • I2 =SUMIFS($F$2:$F$11,$A$2:$A$11,H2) β†’ 8880
  • J2 =COUNTIFS($A$2:$A$11,H2) β†’ 4
  • F3 =D3*E3 β†’ 1000
  • I3 =SUMIFS($F$2:$F$11,$A$2:$A$11,H3) β†’ 1320
  • J3 =COUNTIFS($A$2:$A$11,H3) β†’ 1
  • F4 =D4*E4 β†’ 900
  • I4 =SUMIFS($F$2:$F$11,$A$2:$A$11,H4) β†’ 3240
  • J4 =COUNTIFS($A$2:$A$11,H4) β†’ 2
  • F5 =D5*E5 β†’ 1080
  • I5 =SUMIFS($F$2:$F$11,$A$2:$A$11,H5) β†’ 8200
  • J5 =COUNTIFS($A$2:$A$11,H5) β†’ 3
  • F6 =D6*E6 β†’ 240
  • I6 =SUM(I2:I5) β†’ 21640
  • J6 =SUM(J2:J5) β†’ 10
  • F7 =D7*E7 β†’ 2000
  • F8 =D8*E8 β†’ 3000
  • F9 =D9*E9 β†’ 4800
  • F10 =D10*E10 β†’ 1320
  • F11 =D11*E11 β†’ 4000
For the first ten orders, SUMIFS and COUNTIFS rebuild a PivotTable by region. The totals in row 6 must equal the sum of all orders: 21,640 from 10 orders.

Practice

Guided exercise

Sales by salesperson

In the practice workbook, create a PivotTable showing each salesperson's total sales, largest first.

  1. Insert β†’ PivotTable from the Sales data (with the Total column added).
  2. Drag Salesperson to Rows and Total to Values.
  3. Right-click a number β†’ Sort Largest to Smallest.
Show the solution

Worksheet: PivotTable

RowAB
1Row LabelsSum of Total
2Ravi27,080
3Asha19,850
4Kofi14,850
5Sara14,290
6Meera14,240
7Grand Total90,310

How to get there: Salesperson in Rows gives one row per person; Total in Values sums their orders. Sorting makes the ranking easy to read. The Grand Total is the same as the total of all 48 orders, which is a quick check that nothing was missed.

Your turn

Average order by product

Change the PivotTable to show the average order total for each product. Which product has the highest average order?

Show the solution

Worksheet: PivotTable

RowAB
1Row LabelsAverage of Total
2Backpack3,000
3Desk lamp2,600
4Water bottle2,171
5Sketchbook1,950
6Pen set1,893
7Notebook754

How to get there: Put Product in Rows and Total in Values, then use Value Field Settings β†’ Average. Backpacks have the highest average order because each one costs 1,500. (The averages here are rounded to whole rupees.)

Common mistakes

Forgetting to refresh

You see: The PivotTable shows old numbers

Fix: Right-click β†’ Refresh after changing data.

Blank or merged headings in the data

You see: Excel refuses to create the PivotTable or fields have odd names

Fix: Give every column a unique, single-row heading.

Numbers stored as text

You see: Values show Count instead of Sum

Fix: Fix the data so numbers are real numbers (they align right).

Typing over PivotTable cells

You see: Excel warns you cannot change that part

Fix: Keep calculations outside the PivotTable, or use its own settings.

Recap

  • Insert β†’ PivotTable summarises a table without formulas.
  • Rows and Columns set the layout; Values holds the numbers; Filters narrows the data.
  • Value Field Settings switches between Sum, Count, Average and % of total; dates can be grouped by month.
  • Refresh after data changes, and check key numbers with SUMIFS and COUNTIFS.

Key terms

PivotTable
An interactive summary of a table, built by dragging fields into Rows, Columns, Values and Filters.
Field
A column of the source data, shown by its heading in the PivotTable Fields pane.
Refresh
Recalculating a PivotTable after its source data changes.

Check your understanding

Answer all 4 questions, then check your answers to see an explanation for each one.

  1. 1. Which box gives one row in the summary for each region?

  2. 2. You drag a text field such as Order ID into Values. What does Excel show?

  3. 3. You added new orders but the PivotTable totals did not change. Why?

  4. 4. How can you show each region's share of total sales as a percentage?

Answer all 4 questions to check.

Mark this lesson complete

Finished this lesson?

When you have worked through the examples and exercises, mark it complete to save your progress.