ExcelReady
CourseMock testsFunction guidesBlog
Start freeStart learning for free
ExcelReady

Be Excel-ready before day one. Hands-on practice in your browser, with instant feedback.

Learn

  • Course
  • Mock tests
  • Function guides
  • Blog

Test prep

  • Excel level test
  • Excel test practice
  • Free screening quiz
  • Certificate

Company

  • Editorial policy
  • Contact
  • Terms
  • Privacy

© 2026 ExcelReady. All rights reserved.

  1. Blog
  2. Data tools
  3. Calculated Fields in a Pivot Table

Calculated Fields in a Pivot Table

By ExcelReady Team·Updated November 1, 2026·5 min read

The short answer

A calculated field is a new value column you create inside a pivot table from a formula, such as =Sales-Cost for profit. Click the pivot, go to PivotTable Analyze > Fields, Items & Sets > Calculated Field, type a name and formula, then click Add. It works on summed fields, so ratios work but row-level maths like Units*Price doesn't.

Key takeaways

  • Insert one from PivotTable Analyze > Fields, Items & Sets > Calculated Field.
  • The formula uses field names, not cells: =(Sales-Cost)/Sales gives the margin.
  • Calculated fields work on the sums of fields, so ratios are right but Units*Price is not.
  • For row-level maths, add a helper column to the source data and refresh instead.
  • Edit or delete a calculated field from the same dialog by picking its name.
On this page+
  1. What is a calculated field?
  2. How to add a calculated field to a pivot table
  3. The rule: calculated fields use totals, not rows
  4. Calculated fields for percent change
  5. How to edit, list or delete a calculated field
  6. Limits and common errors
  7. Practise it

A calculated field in a pivot table is a new value you build from a formula, such as profit from Sales minus Cost, without adding a column to your data. You create it once and it fills in for every row, column and total of the pivot. This guide shows the steps, the one rule that makes calculated fields go wrong, and how to edit or remove them.

What is a calculated field?#

A calculated field is a formula that uses other fields in the pivot's source data. It appears in the PivotTable Fields list like a normal field, and you drag it into Values. Common examples:

Calculated fieldFormula
Profit=Sales-Cost
Margin=(Sales-Cost)/Sales
Average price=Sales/Units
Growth=(Sales2024-Sales2023)/Sales2023

The examples use this list in A1:E9:

ABCDE
1RegionProductUnitsSalesCost
2EastLaptop336002700
3WestPhone530002100
4EastPhone424001800
5SouthLaptop224001700
6WestLaptop11200900
7EastTablet618001100
8NorthPhone21200800
9SouthTablet3900600

How to add a calculated field to a pivot table#

Start with a pivot that has Region in Rows and Sales in Values. Then:

  1. Click any cell inside the pivot.
  2. Go to PivotTable Analyze > Fields, Items & Sets > Calculated Field. The menu is the same on Windows and Mac.
  3. In Name, type Margin.
  4. In Formula, delete the 0 after the equals sign. Type =(, double-click Sales in the Fields list, type -, double-click Cost, type )/, and double-click Sales again. The formula reads =(Sales-Cost)/Sales.
  5. Click Add, then OK.

Excel adds Sum of Margin to the Values area. It shows decimals like 0.282, so format it: click the field's drop-down in the Values box, choose Value Field Settings > Number Format and pick Percentage.

RegionSum of SalesSum of Margin
East780028.2%
North120033.3%
South330030.3%
West420028.6%
Grand Total1650029.1%

To rename "Sum of Margin", click the heading cell and type a new name. It can't be exactly the same as a field name, so type Margin % or add a space at the end.

The rule: calculated fields use totals, not rows#

A calculated field doesn't run on each source row. Excel first sums each field for the group, then applies your formula to those sums. For East, the margin is (7,800 − 5,600) / 7,800 = 28.2%. That is the right answer for a ratio, because a group's margin should come from its total sales and total cost.

The same rule breaks formulas that must work row by row. Imagine the data had Units and Price instead of Sales, with prices of 1,200 for laptops, 600 for phones and 300 for tablets. A calculated field =Units*Price for East would multiply total units (3 + 4 + 6 = 13) by the sum of the prices (1,200 + 600 + 300 = 2,100) and show 27,300. The real East sales are 3×1,200 + 4×600 + 6×300 = 7,800.

The fix is to do row-level maths in the source data: add a Sales column with =C2*D2 filled down, refresh the pivot, and sum that column. Keep calculated fields for ratios and differences of totals.

Calculated fields for percent change#

If your data has one column per year, a calculated field can show growth. With Sales2023 and Sales2024 columns, the formula =(Sales2024-Sales2023)/Sales2023 gives each group's percent change, formatted as a percentage. It follows the usual percent change rule, (new − old) / old.

If the year is a field instead, with one Year column and one Sales column, you don't need a calculated field. Put Year in Columns, then right-click a value and choose Show Values As > % Difference From, with Year as the base field and (previous) as the base item. For a share of the total instead of growth, use percent of total in a pivot table.

How to edit, list or delete a calculated field#

All three happen in the same places:

  • Edit. Open Calculated Field again, pick the field in the Name drop-down, change the formula and click Modify.
  • Delete. Pick the field in Name and click Delete. Unticking it in the field list only hides it, and it still exists in the pivot cache.
  • List all formulas. Go to PivotTable Analyze > Fields, Items & Sets > List Formulas. Excel adds a new sheet listing every calculated field and its formula, which is useful when you take over someone else's file.

Limits and common errors#

Calculated fields are handy, but they have limits worth knowing:

  • No cell references. You can't use B1 or a named range in the formula. Put the number in the formula itself.
  • #DIV/0! in some rows. A group with zero sales divides by zero. Use =IF(Sales=0,0,(Sales-Cost)/Sales).
  • Greyed out. The option isn't available in pivots built on the Data Model; those use measures.
  • Not the same as a calculated item. A calculated item adds a new item inside a field, such as "East + West" in Region. It's rarely needed and easy to double-count with.
  • Errors after renaming source headers. If a field the formula uses disappears from the source, the pivot can't refresh. See the fix for the pivot field name is not valid error.

When a report needs ratios in fixed cells, a formula like =(SUM(D2:D9)-SUM(E2:E9))/SUM(D2:D9) gives the overall 29.1% margin with no pivot at all. The comparison of pivot tables vs SUMIFS helps you choose. Margins by month work too, once you group the dates in the pivot.

Practise it#

Calculated fields and the "totals, not rows" rule are favourite topics in pivot table interview questions. Practise pivot tables in a live spreadsheet, with nested rows, filters and percent of total, checked instantly. Then practise percentages and percent change so the margin and growth formulas come naturally.

Try it yourself

This is a live spreadsheet. Type the formula in the green cell and press Enter.

A calculated field =(Sales-Cost)/Sales would show the overall margin in the Grand Total row. Check it with a formula: in G2, subtract the total of E2:E9 from the total of D2:D9, then divide by the total of D2:D9.

fx
ABCDEFGH
1
Region
Product
Units
Sales
Cost
Overall margin
2
East
Laptop
3
3600
2700
3
West
Phone
5
3000
2100
4
East
Phone
4
2400
1800
5
South
Laptop
2
2400
1700
6
West
Laptop
1
1200
900
7
East
Tablet
6
1800
1100
8
North
Phone
2
1200
800
9
South
Tablet
3
900
600
10
11
12

Tip: Put the subtraction in brackets so it happens first: (SUM of sales minus SUM of cost), then divide by SUM of sales.

Practise this in a lesson

LessonPivot tables 2Go further with PivotTables: nest two row fields with subtotals, add a report filter, show values as a % of the grand total, update the source when new rows arrive, and know when SUMIFS is the better tool.LessonPercentages and % changeCalculate percent change with (new - old) / old, format it as a percentage, and grow a number by a percent.

Frequently asked questions

How do I add a calculated field to a pivot table?

+

Click inside the pivot, go to PivotTable Analyze > Fields, Items & Sets > Calculated Field. Type a name, build the formula with field names such as =Sales-Cost, click Add and then OK.

Why is my pivot table calculated field wrong?

+

Calculated fields work on the total of each field, not row by row. A formula like =Units*Price multiplies total units by total price. Add a Sales column to the source data instead.

Can a calculated field reference a cell?

+

No. Calculated field formulas can only use numbers, operators, some worksheet functions and other fields from the pivot's source. Cell references and named ranges aren't allowed.

How do I delete a calculated field in a pivot table?

+

Open the Calculated Field dialog again, choose the field in the Name drop-down and click Delete. Unticking it in the field list only hides it.

Why is Calculated Field greyed out?

+

The pivot was built on the Data Model, which uses measures instead of calculated fields. Calculated Field is also unavailable if the active cell isn't inside the pivot.

Sources

  • Create a PivotTable to analyze worksheet data - Microsoft Support
  • Show different calculations in PivotTable value fields - Microsoft Support
  • Calculate percentages - Microsoft Support

Written and checked by the ExcelReady Team. First published November 1, 2026. The practice exercise runs in the same formula engine as our lessons. Found a mistake? Read our editorial policy or email hello@excelready.app.

On this page

  1. What is a calculated field?
  2. How to add a calculated field to a pivot table
  3. The rule: calculated fields use totals, not rows
  4. Calculated fields for percent change
  5. How to edit, list or delete a calculated field
  6. Limits and common errors
  7. Practise it

Keep reading

Data tools· 6 min read

Pivot Table Tricks: Subtotals, Filters and % of Total

To show a percent of total in a pivot table, click the ▾ on the field in the Values area, choose Value Field Settings, open Show Values As and pick % of Grand Total. Each number then shows its share of the total, and the parts add up to 100%. You can also right-click a value and choose Show Values As.

Errors & fixes· 5 min read

"PivotTable Field Name Is Not Valid": How to Fix It

Excel shows "The PivotTable field name is not valid" when a column in the source data has no header. Every column in the range needs a label in the first row. Type a header into any blank header cell, unmerge merged headers, and make sure the source range has no empty columns. Then create or refresh the pivot.

Data tools· 5 min read

Group Dates by Month or Year in a Pivot Table

To group dates in a pivot table, put the date field in Rows, right-click any date and choose Group. In the Grouping box, select Months and Years, then click OK. The pivot then shows one total per month, split by year. If Excel says it cannot group the selection, the date column holds blanks or text.

Don't just read about Excel. Do it.

Practise real formulas in a live spreadsheet with instant feedback, right in your browser. Nothing to download.

Start learning for free