Learning Objectives

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

  • Decide when a pivot table answers faster than manual SUMIF sheets
  • Build pivots with Rows, Columns, Values, and Filters
  • Change Value Field Settings to Sum, Count, Average, and percent of total
  • Create pivot charts that stay linked to the pivot
  • Add slicers for interactive filtering and refresh pivots after source edits

Sample file: sales_data_large.csv


Why Pivot Instead of Many SUMIFs

One SUMIF answers one question. A pivot answers many at once, reshapes with a drag, and regroups without rewriting formulas. Manual sheets also risk missing new rows. A pivot from an Excel Table grows with the source and refreshes by command.

Question Manual Approach Pivot Approach
Total sales by Region Four SUMIF formulas Region to Rows, Sales to Values
Average units by Product Four AVERAGEIF formulas Product to Rows, Units to Values as Average
Share of each Region Helper percent column Show Values As percent of Grand Total
Interactive filter by Region Filter the source and resummarise Slicer on Region

Prerequisites hold for both: clean headers, one row per record, no totals row mixed into the source, and no extra spaces in keys such as West versus West with a trailing space.


1) Build a Pivot

  1. Click one cell inside the Sales table. If the data is plain range, consider pressing Ctrl+T to create an Excel Table first so the pivot range expands later.
  2. Go to Insert then PivotTable. Choose New Worksheet and name the sheet Pivot.
  3. In the Field List, drag fields to areas:
Area Field
Rows Region
Values Sum of Sales Amount
Values again Sum of Units Sold
  1. Format Sales Amount as Accounting or Currency in NPR with no decimals for this dataset.
  2. Optional hierarchy: drag Product under Region to see product within region.

Change value settings

Right click a value cell and choose Value Field Settings:

  • Summarize by: Sum, Count, Average
  • Show Values As: No Calculation, percent of Grand Total, percent of Row Total

Changing between these requires no new formula. One click repurposes the same pivot.

2) Pivot Charts

A PivotChart is a chart that listens to the pivot. Filtering the pivot filters the chart.

  1. Select the pivot. Go to PivotTable Analyze then PivotChart.
  2. Choose Clustered Column for region comparison, or Pie for share of total.
  3. Set the chart title to Sales by Region or the specific metric shown.
  4. Keep the chart linked. If you need a standalone chart, create a normal chart from pasted pivot values on a Dashboard sheet instead.

3) Slicers for Interactive Filtering

Slicers are visual filters that replace drop down clicks with buttons.

  1. Click the pivot. Go to PivotTable Analyze then Insert Slicer.
  2. Tick Region and optionally Product. The slicer appears as a panel of buttons.
  3. Click a button to filter the pivot and its chart. Hold Ctrl for multi select.
  4. Clear with the funnel icon on the slicer header.

Slicers appear in Model Lab Test Set B. Practise them here so the timed test feels familiar.

4) Group Dates

If the source holds a Date field:

  1. Drag Date to Rows.
  2. Right click a date cell and choose Group, then select Months, Quarters, or Years.
  3. Build a monthly trend line chart from the grouped pivot.

5) Refresh and Integrity

  • After editing source rows, right click the pivot and choose Refresh. The same sits under PivotTable Analyze then Refresh.
  • If you added columns outside the original range and the source is not a Table, change the PivotTable source range to include them.
  • Never type manually inside pivot value cells. The pivot overwrites typed values on the next refresh. Change the source data instead.

Errors and Fixes

Problem Cause Fix
New data does not appear in the pivot Pivot not refreshed or source range too small Refresh, or use an Excel Table as source so the range grows
Values show Count of Sales instead of Sum Some sales cells hold text or blanks Convert text numbers to numbers, then change Summarize by to Sum
Region appears twice as West and West with a space Extra spaces or inconsistent spelling in source Clean the source with TRIM or Find and Replace
Typed numbers inside the pivot disappear Pivot cells recalculate on refresh Never type in a pivot, edit the source
Slicer does not filter the chart Chart was a normal chart from a range, not a PivotChart Create the chart with PivotChart so it links
Group button is grey Date column holds text dates, not real dates Convert the column to date format first

Nepal Worked Example: Sales by Region With Chart and Slicer - BS 2081-10-12

A student works on 2081-10-12 BS with an eight row extract in NPR, the same set used for Data Management.

Region Salesperson Units Sales Rs.
East Ram 12 24,000
West Sita 5 9,500
North Hari 8 16,800
West Gita 15 31,500
South Bikash 3 5,400
East Anita 9 18,900
West Kiran 7 12,600
North Maya 11 22,000

Pivot built as Region to Rows, Sales and Units to Values:

Region Sum of Sales Rs. Sum of Units
East 42,900 21
North 38,800 19
South 5,400 3
West 53,600 27
Grand Total 140,700 70

Arithmetic check: 42,900 plus 38,800 plus 5,400 plus 53,600 equals 140,700. Units 21 plus 19 plus 3 plus 27 equals 70. Both tie to the source row sums.

Percent of grand total variant: right click a Sales value then Show Values As percent of Grand Total. West 38.10%, East 30.49%, North 27.58%, South 3.84%. These four sum to 100.01% due to rounding at two decimals, which is expected.

Average variant: change Sum of Units to Average. Result for West is 9.00 units, East 10.50, North 9.50, South 3.00. This separates totals from typical order size.

Chart and slicer: Insert PivotChart as Clustered Column titled Sales by Region. Insert Slicer for Region and click West. The pivot and chart narrow to West only with Sales 53,600 and Units 27 visible. Clear the slicer to return to all regions.

Refresh test: In the source, change Ram Sales from 24,000 to 30,000, then Refresh. East becomes 48,900, grand total becomes 146,700, and West percent falls to 36.54%, which proves the link between source and summary.

Self-check

Your pivot shows Count of Sales instead of Sum, West appears twice, and new rows below row 9 are missing after Refresh. The slicer also fails to filter the chart. What four fixes cover this?

Summary

Pivot tables reshape a clean source with Rows, Columns, Values, and Filters. Value Field Settings switch between Sum, Count, Average, and percent views. PivotCharts and slicers make the same summary visual and interactive. Refresh ties edits in the source to the summary without rewriting formulas.

Key Takeaways

  • Use Rows for categories, Values for numbers. Drag again to change the question.
  • Show Values As percent of Grand Total answers share questions without helper columns.
  • A PivotChart stays linked to its pivot. A normal chart does not listen.
  • Slicers filter by button. Multi select with Ctrl, clear with the funnel.
  • Build the source as an Excel Table with Ctrl+T and refresh after every source edit.
  • Never type inside the pivot body. Change the source instead.

Discussion

Why does a pivot refresh but still miss rows, and why does a Table source fix that? When does Average reveal more than Sum for Units? How does a trailing space after West break a summary that otherwise looks correct?

Exercises

  1. Pivot build (calculable): From the eight rows, report Sum of Sales and Sum of Units by Region with a grand total. Verify the two grand totals against source sums.
  2. Percent and average: Show Sales as percent of Grand Total and Units as Average. Report West percent and West average units.
  3. Chart plus slicer: Create a PivotChart with title and a slicer for Region. Filter to East and report the filtered Sales total.
  4. Refresh proof: Change two source values, refresh, and report the movement in one region total and in the grand total.

📚 Continue to: Linking Workbooks