A Pivot Table with Rows and Columns
About this lesson
A pivot table with rows and columns has one group down the side and another across the top, and a total where each row meets each column. Here you build it with formulas, not with Excel's PivotTable tool. One SUMIFS and mixed references fill every cell of the table.
- build a pivot table with rows and columns using SUMIFS.
- use $D2 and E$1 so one formula fills a whole table.
- total a summary table at the bottom.
The idea
Rows and columns is the pivot table most people mean. Two conditions decide each cell: the row's region and the column's product. SUMIFS tests both.
The trick is in the references. $D2 locks the column, so filling to the right keeps reading the region. E$1 locks the row, so filling down keeps reading the product. One formula, written once in the top-left cell, fills the whole table when it is copied.
The mistake to watch for
Fixing both parts of every reference. With $D$2 and $E$1 the formula gives the same number in every cell, because nothing moves when it is filled. Lock only the column letter of the row label and only the row number of the column heading.
Read more about this
Where this comes up again
This lesson needs JavaScript to run. Everything below is the lesson in full, but you cannot type into the grid or be marked.
SUMIFS can test more than one condition at once.
In E2, type: =SUMIFS($C$2:$C$10,$A$2:$A$10,$D2,$B$2:$B$10,E$1). $D2 locks the column, E$1 locks the row.
| Row | A | B | C | D | E | F | G |
|---|---|---|---|---|---|---|---|
| 1 | Region | Product | Sales | Bikes | Helmets | Locks | |
| 2 | North | Bikes | 400 | North | |||
| 3 | South | Helmets | 50 | South | |||
| 4 | North | Locks | 30 | Total | |||
| 5 | South | Bikes | 500 | ||||
| 6 | North | Helmets | 70 | ||||
| 7 | South | Locks | 40 | ||||
| 8 | North | Bikes | 300 | ||||
| 9 | South | Helmets | 100 | ||||
| 10 | South | Locks | 10 |
Every step
-
SUMIFScan test more than one condition at once. InE2, type:=SUMIFS($C$2:$C$10,$A$2:$A$10,$D2,$B$2:$B$10,E$1).$D2locks the column,E$1locks the row. -
In
F2, copy the formula but end it withF$1. -
Filled down one row, the formula in
E2becomes=SUMIFS($C$2:$C$10,$A$2:$A$10,$D3,$B$2:$B$10,E$1). Read it and say what it returns. -
In
G3, total South Locks with$D3andG$1. -
In
E4, addE2andE3withSUM. -
In
G4, total the Locks column withSUM.