PivotTable or SUMIFS? Two ways to build a summary
A PivotTable builds a summary in a few clicks; SUMIFS builds one you control cell by cell. What each does well, where each goes wrong, and how to check.
A PivotTable and SUMIFS can build the same summary. A PivotTable takes a few clicks, but it does not change until you refresh it. SUMIFS takes longer to set up, and it updates by itself.
Here is the situation. A small design studio keeps its invoices in one list. At the end of the month the owner wants one number per client and per service. Type the list in A1 to D11.
| Row | A | B | C | D |
|---|---|---|---|---|
| 1 | Invoice | Client | Service | Amount |
| 2 | 101 | Brook | Design | 400 |
| 3 | 102 | Carter | 150 | |
| 4 | 103 | Brook | 90 | |
| 5 | 104 | Delta | Design | 650 |
| 6 | 105 | Carter | Design | 300 |
| 7 | 106 | Brook | Design | 250 |
| 8 | 107 | Delta | 120 | |
| 9 | 108 | Carter | 200 | |
| 10 | 109 | Delta | Design | 380 |
| 11 | 110 | Brook | 60 |
Both ways give this summary. The grand total is 2600, the same as the list.
| Client | Design | Total | |
| Brook | 650 | 150 | 800 |
| Carter | 300 | 350 | 650 |
| Delta | 1030 | 120 | 1150 |
| Total | 1980 | 620 | 2600 |
Build it with a PivotTable
- Click any cell in the list.
- On the Insert tab, click PivotTable. Excel shows the range it found: A1:D11.
- Choose New Worksheet and click OK. An empty PivotTable and the PivotTable Fields pane open.
- Drag Client to the Rows box.
- Drag Service to the Columns box.
- Drag Amount to the Values box. It shows as "Sum of Amount".
That is all. Excel adds a Grand Total row and column for you. The clients are sorted A to Z.
Look at the Values box after step 6. If it says "Count of Amount", the column has an empty cell or some text in it. Excel counts instead of adding when a column is not all numbers. Fix the list, or right-click a value and choose Summarize Values By, then Sum.
Build it with SUMIFS
Type the labels first. Put Client in F1, Design in G1, Print in H1 and Total in I1. Put the 3
clients in F2 to F4. In Excel 2021 or later, or Microsoft 365, you can type
=UNIQUE(B2:B11) in F2. It fills F2 to F4 with Brook, Carter and
Delta.
In G2, type
=SUMIFS($D$2:$D$11,$B$2:$B$11,$F2,$C$2:$C$11,G$1). It gives
650.
Fill it right to H2, then fill G2:H2 down to row 4. Brook Print is 150. Carter is 300 and 350. Delta is 1030 and 120.
In I2, type =SUM(G2:H2) and fill it down. In G5, type
=SUM(G2:G4) and fill it right to I5. I5 gives 2600.
The dollar signs do the work. $F2 keeps column F, so every cell
reads its own client. G$1 keeps row 1, so every cell reads its
own service. The ranges have both signs, so they never move.
For a count, use COUNTIFS with the same tests.
=COUNTIFS($B$2:$B$11,$F2,$C$2:$C$11,G$1) gives 2, because Brook
has 2 design invoices. With one test, SUMIF is enough.
=SUMIF($B$2:$B$11,$F2,$D$2:$D$11) gives 800 for Brook.
Where each one goes wrong
On the day you build them, the two tables match. The difference shows up next week, when the list changes.
A number in the list changes
Change D4 from 90 to 190. The SUMIFS cell for Brook Print changes to 250 at once. I5 becomes 2700.
The PivotTable still says 150. It keeps a copy of the data and does not look again until you refresh it. Right-click inside it and choose Refresh, or press Alt+F5. Data, then Refresh All, updates every PivotTable in the file.
This is the most common PivotTable mistake at work. The file is sent with old numbers, and nothing on the screen says they are old.
A new row is added under the list
Type invoice 111 in row 12: Carter, Design, 500. The list total is now 3100.
Neither table sees it. The SUMIFS ranges stop at row 11, so Carter Design stays 300. The PivotTable was built on A1:D11, and Refresh does not make that range longer. You have to change the source with PivotTable Analyze, then Change Data Source.
The fix for both is the same. Click the list and press Ctrl+T to make it an Excel table. A PivotTable built on a table picks up new rows when you refresh. A SUMIFS grows with it too, if you click the table columns while you write it.
A name has a space on the end
Say B11 holds "Brook " with a space after it. You cannot see the space.
The PivotTable shows two Brook rows. That looks strange, so somebody notices and cleans the name.
SUMIFS looks for "Brook" and does not match "Brook ". So Brook Print drops from 150 to 90. There is no error and no extra row. The total in I5 is 2540, which is 60 short. Only a check against the list finds it.
A new client appears
When you refresh, a PivotTable adds a row for a new client in its range. A SUMIFS table only has the labels you typed. A new client is left out, and the total check below shows the gap. UNIQUE can keep the labels up to date. You still have to fill the SUMIFS down to each new label.
Check it the same way every time
A summary is right when its total equals the list total. Put this under the SUMIFS table:
=I5-SUM(D2:D11). It must give 0.
With the spaced name it gives -60. With the new row it gives -500. A number that is not 0 means a row is missing or counted twice.
For a PivotTable, compare its Grand Total with
=SUM(D2:D11) after every refresh. When you type = and click a
cell inside a PivotTable, Excel writes a GETPIVOTDATA formula. That is normal. It finds the
number by its labels, so it still works if the PivotTable changes shape.
Which one to use
Use a PivotTable when you want to explore a list and answer a question today. You can drag Service to Rows, or swap Sum for Count, in a second. Nothing is typed, so there is no formula to get wrong.
Use SUMIFS when the summary is a report other people open every month. It updates by itself. It stays in the cells you chose, with your own labels and formats. Other formulas can point at it. You can also put a total, a share or a target next to any cell.
Many people use both. Build a PivotTable first to see the answer. Then build the SUMIFS report and check that the two grand totals match.
In Microsoft 365 there is a third way. GROUPBY builds the summary from one formula and grows when the list grows. The GROUPBY function article shows it. For more SUMIFS, try the SUMIF and SUMIFS exercises.
The lessons below build the same summaries with formulas, so you can see what a PivotTable does. Each lesson is a real sheet you type into, and each answer is checked when you press Enter.