Your first pivot table
Bisi wants revenue broken down by branch and by category at the same time. Seven categories, three branches.
With SUMIFS you'd write 21 formulas, plus 10 more for the totals. Each one is a chance to mistype a range, and if Bisi then asks for it by month instead, you write 21 more.
With a pivot table it takes about thirty seconds, the totals cannot disagree with the cells, and changing "category" to "month" is one drag.
Pivot tables are the single biggest jump in speed you will make in this course. They are also where careless analysts produce confident, beautiful, wrong tables, so this lesson teaches the check as well as the tool.
Words in this lesson
| Word | What it means, in plain English |
|---|---|
| Pivot table | A summary table you build by dragging fields, not writing formulas. |
| Source data | The rows the pivot summarises. Your clean table. |
| Rows / Columns | The fields that become the side and the top of the summary. |
| Values | The field being calculated in the middle. |
| Crosstab | A table with one thing down the side and another across the top. |
| Refresh | Telling a pivot table to re-read its source data. |
What a pivot table actually does
It takes a long list and answers: "for each combination of these fields, what is the total of that field?"
Your 938 rows go in. A 3 × 7 summary comes out. Nothing is lost: the pivot is a view of the data, not a change to it. Your clean table is untouched.
Four places to drop a field:
| Area | What it does |
|---|---|
| Rows | One row per distinct value, down the side |
| Columns | One column per distinct value, across the top |
| Values | The number in the middle, usually a total |
| Filters | Restricts which rows are included at all |
Build one: Google Sheets
According to Google's help centre:
- Select the cells containing your source data. Each column needs a header — which your Module 2 table already has.
- In the menu at the top, click Insert → Pivot table.
- Click the pivot table sheet if it isn't already open.
- In the side panel, next to Rows or Columns, click Add, then choose a field.
- Next to Values, click Add, then choose the field you want calculated.
For Bisi's crosstab: Rows = category, Columns = branch, Values = amount_ngn.
About those suggestions
Google notes that you'll sometimes see recommended pivot tables based on the data you choose, under "Suggested", and that high confidence suggestions are automatically inserted when the pivot table is created.
Treat a suggestion as a starting point, never as an answer. It doesn't know what question you're asking. To turn them off, Google says: at the top click Tools → Suggestion controls, then turn off Enable Pivot table suggestions.
Build one: Excel
According to Microsoft's support page:
- Select the cells you want to create a PivotTable from. Microsoft notes your data should be organised in columns with a single header row.
- Select Insert → PivotTable.
- Choose where it goes: New Worksheet, or Existing Worksheet and pick a location.
- Select OK.
- In the PivotTable Fields pane, tick the field names.
Microsoft describes the default placement: non-numeric fields go to Rows, date and time hierarchies to Columns, and numeric fields to Values. Drag a field to a different area to move it.
The result
| Category | Yaba | Ikeja | Surulere | Total |
|---|---|---|---|---|
| Grains | 2,754,600 | 1,672,300 | 1,115,300 | 5,542,200 |
| Oils | 868,000 | 416,400 | 181,600 | 1,466,000 |
| Noodles and pasta | 741,400 | 490,400 | 148,400 | 1,380,200 |
| Household | 415,900 | 405,650 | 155,150 | 976,700 |
| Dairy and beverages | 350,800 | 274,700 | 116,800 | 742,300 |
| Baking and sweeteners | 268,900 | 234,300 | 67,800 | 571,000 |
| Seasoning | 187,300 | 110,800 | 49,800 | 347,900 |
| Total | 5,586,900 | 3,604,550 | 1,834,850 | ₦11,026,300 |
Twenty-one numbers and ten totals, from four clicks.
To show those totals, Google's help says: under Rows or Columns, check Show totals.
The check that makes it trustworthy
Look at the grand total. It must be ₦11,026,300.
That is the same number you proved in lesson 2.5 against the till system's TOTAL JANUARY row, and reconciled again in Module 3. If your pivot's grand total matches, every cell in it is drawn from the dataset you verified.
If it doesn't match, stop. One of these is true:
| Grand total is | Likely cause |
|---|---|
| Lower than ₦11,026,300 | Your selection missed rows, or a filter is active |
| Higher | Your selection includes the old raw sheet, or duplicate rows crept back |
| Wildly different | You selected the wrong column for Values |
| A count like 938, not a naira figure | Your amount column is text |
That last one deserves its own section.
When a pivot shows 938 instead of ₦11,026,300
Microsoft's support page is explicit: PivotTable fields placed in the Values area are displayed as a SUM by default, but if Excel interprets your data as text, the data is displayed as a COUNT. Microsoft adds that this is why it matters not to mix data types in value fields.
So a pivot that stubbornly counts instead of totalling is not a pivot problem. It is telling you that Module 2's conversion missed something, and the fix is back in lesson 2.2: test with ISNUMBER, compare COUNT with COUNTA, convert properly.
A pivot table is an excellent data-quality detector. It surfaces in one glance what a column of formulas will hide for weeks.
Pivots do not update themselves
This catches everyone once.
Microsoft's page: if you add new data to your source, any PivotTables built on that source need to be refreshed. Right-click anywhere in the PivotTable range and select Refresh; for several at once, select a cell in any PivotTable, then PivotTable Analyze → the arrow under Refresh → Refresh All.
The failure mode is quiet and expensive: you add April's sales, glance at the dashboard, and the numbers look plausible because they're last month's. After changing source data, refresh, then re-check the grand total.
Reading the table you just built
Look at the crosstab again, because it says something.
Grains is ₦5,542,200 — 50.3% of everything Bisi sells. Half her business is rice, beans, garri and semolina. That concentration is the most important fact on the page: it means her results depend heavily on one category's supply and price, and a rice shortage is not a category problem, it's a business problem.
And it holds in every branch: Grains is the top category at Yaba, Ikeja and Surulere alike. That's worth knowing, because it means the branches differ in size, not in what they are.
Common mistakes
| Mistake | Better |
|---|---|
| Selecting the raw sheet as source | Always the clean table from Module 2 |
| Source data with no header row | Both tools require a single header row |
| Not checking the grand total | It must be ₦11,026,300 |
| Accepting a suggested pivot as the answer | It doesn't know your question |
| Assuming the pivot updated when the data did | Refresh, then re-check the total |
| Fighting a pivot that counts instead of sums | Your value column is text; fix it in the source |
| Typing over a pivot table's cells | Pivot output is generated; edit the pivot, not the result |
The short version
- A pivot table summarises a long list by Rows, Columns, Values and Filters, without formulas, and without changing your data.
- Google: Insert → Pivot table, then add fields in the side panel. Each column needs a header.
- Excel: Insert → PivotTable, then tick fields in the PivotTable Fields pane. Single header row.
- Always check the grand total: ₦11,026,300. It ties the pivot back to the figure you proved in Module 2.
- Microsoft: values default to SUM, but show as COUNT if the data is read as text — a free data-quality check.
- Pivots don't refresh themselves. Refresh after changing source data.
- Bisi: Grains is 50.3% of revenue, and the top category in all three branches.
Try it yourself
- Build the branch × category pivot from your clean table. Confirm the grand total reads ₦11,026,300.
- Compare three cells against the SUMIFS answers you built in lesson 3.4. They must agree exactly.
- Swap
categoryforpayment_typein Rows. You should get Transfer ₦4,501,600, Cash ₦3,442,150, POS ₦3,082,550. - Drag
branchfrom Columns to Rows and back. Note that the grand total never changes, only the arrangement. - Break it deliberately: in a copy of your data, retype one amount with a naira sign so it becomes text. Rebuild the pivot and record what happens to the total.
- Add a row to your source data, then look at the pivot before and after refreshing. Write one sentence about what you saw.
- Write two sentences for Bisi about what the Grains figure means for her business.
You'll know you've got it when building a two-way summary takes you under a minute, and you check the grand total before you read a single cell.
More free previews
- ▶What analysts actually spend their time on15 min
- ▶The five things that break a spreadsheet20 min
- ▶SUM, COUNT and AVERAGE without embarrassing yourself20 min
- ▶Averages that mislead: mean, median and mode20 min
- ▶Why analysts learn SQL even with Excel15 min
- ▶Choose the right chart for the question20 min
- ▶Write findings a busy manager will act on25 min
- ▶Choose a dataset and a question worth answering20 min