Calculated fields in a PivotTable: formulas, examples and limitations
Add a calculation to a PivotTable without touching the source: average price, bonus, margin — and see where a calculated field silently goes wrong.
Your PivotTable has amount and quantity, but the manager asks: “What is the average price in each region?” You could add a column to the source, but sometimes the data belongs to another department or must not be changed.
A Calculated Field is a new field that lives inside the PivotTable. Its formula is built from other fields: =Amount/Qty, =Amount*0,05. It appears in the field list like a regular column and goes into Values.
But it has one crucial property — it calculates on sums, not row by row. Miss that and your report will be silently wrong. Details below.
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Row Labels | Sum of Amount | Sum of Qty | Sum of Price | |
| 2 | Bukhara | 26 600 000 | 5 | 5 320 000 | |
| 3 | Samarkand | 20 500 000 | 6 | 3 416 667 | |
| 4 | Tashkent | 41 500 000 | 9 | 4 611 111 | |
| 5 | Grand Total | 88 600 000 | 20 | 4 430 000 | |
| 6 |
Adding a calculated field
1
Click any cell in the PivotTable. PivotTable Analyze → Fields, Items & Sets → Calculated Field....
2
In the Insert Calculated Field dialog type the new field’s Name: Price. In Formula delete the 0, then after = double-click Amount in the Fields list, type / and double-click Qty.
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Row Labels | Sum of Amount | Sum of Qty | |
| 2 | Bukhara | 26 600 000 | 5 | |
| 3 | Samarkand | 20 500 000 | 6 | |
| 4 | Tashkent | 41 500 000 | 9 | |
| 5 | Grand Total | 88 600 000 | 20 | |
| 6 |
3
Click Add, then OK. Price appears in the field list and is placed in Values automatically as Sum of Price. Format it via Value Field Settings → Number Format (the result above).
4
If a field name contains a space, wrap it in apostrophes in the formula: ='Sales amount'/Qty. Insert fields by double-clicking them in the list and Excel adds the apostrophes for you.
Key point: the formula runs on totals, not on rows
Excel first adds up the fields for each group, then applies the formula to those totals. For Tashkent: total Amount 41,500,000, total Qty 9 → Price = 41,500,000 / 9 = 4,611,111. That’s correct — a weighted average price.
But a formula with multiplication breaks. Suppose the source has Price and Qty columns but no Amount. A calculated field =Price*Qty does not multiply price by quantity on each row — it multiplies the sum of prices by the sum of quantities:
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Product | Price | Qty | Amount | |
| 2 | Laptop | 8 500 000 | 3 | 25 500 000 | |
| 3 | Printer | 3 200 000 | 2 | 6 400 000 | |
| 4 | Correct total | 31 900 000 | |||
| 5 | Calculated Field | 58 500 0001 | |||
| 6 |
=Price*Qty field shows (8.5M + 3.2M) × 5 = 58,500,000| A | B | C | D | |
|---|---|---|---|---|
| 1 | Row Labels | Sum of Amount | Sum of Bonus | |
| 2 | Bukhara | 26 600 000 | 2 660 000 | |
| 3 | Samarkand | 20 500 000 | 1 025 000 | |
| 4 | Tashkent | 41 500 000 | 4 150 000 | |
| 5 | Grand Total | 88 600 000 | 8 860 0001 | |
| 6 | Sum of bonuses | 7 835 000 | ||
| 7 |
Limitations of calculated fields
- Sums only. The formula always works on the SUM of each field — even if you pick Average or Count in Values.
- No cell references.
=Amount*B1, named ranges and other sheets don’t work — only field names and constants:=Amount*0,12. - Can’t count rows. If you need to divide by the number of sales, add a helper column of 1s to the source and use it as a field.
- Text fields can’t take part in arithmetic.
- Data Model PivotTables have no calculated fields — use DAX measures (Power Pivot) there.
Simple rule: ratios (Amount/Qty, margin = (Amount−Cost)/Amount) come out right in a calculated field. Products and conditions should be calculated row by row in the source.
Pro level: calculated items, editing and the formula list
A Calculated Item adds a new item inside a field. For example, in Region — “Regions” = Bukhara + Samarkand. But it’s risky: the Grand Total counts Bukhara and Samarkand twice, it doesn’t work at all in a grouped field, and it noticeably slows down a big PivotTable. Usually plain grouping is enough instead.
Editing and deleting. Open the same Insert Calculated Field dialog and pick the field from the Name list — the button changes to Modify; click Delete to remove it.
Documenting. PivotTable Analyze → Fields, Items & Sets → List Formulas — Excel lists every calculated field and item formula of the PivotTable on a new sheet. Very handy before handing a report over to someone else.
Try it in the simulator
Check the calculated field with a formula: type =СУММЕСЛИМН($C$2:$C$8;$A$2:$A$8;D2)/СУММЕСЛИМН($B$2:$B$8;$A$2:$A$8;D2) in E2 and fill it down to E4. Tashkent: 4611111.11 — the same as Price in the PivotTable.
| A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | Region | Qty | Amount | Region | Price | |||||||||||||||||||
| 2 | Tashkent | 3 | 25500000 | Bukhara | ||||||||||||||||||||
| 3 | Samarkand | 5 | 12000000 | Samarkand | ||||||||||||||||||||
| 4 | Tashkent | 2 | 6400000 | Tashkent | ||||||||||||||||||||
| 5 | Bukhara | 2 | 17000000 | |||||||||||||||||||||
| 6 | Samarkand | 1 | 8500000 | |||||||||||||||||||||
| 7 | Tashkent | 4 | 9600000 | |||||||||||||||||||||
| 8 | Bukhara | 3 | 9600000 | |||||||||||||||||||||
| 9 | ||||||||||||||||||||||||
| 10 | ||||||||||||||||||||||||
| 11 | ||||||||||||||||||||||||
| 12 |
Has ExcelLab been useful?
Support the project and help us release new lessons and exercises.