What a calculated field does and when you need one
A calculated field is a column you create inside a pivot table that performs math on the data already there. Instead of manually adding a formula in a separate column, you build the calculation directly into the pivot table itself. When the pivot table updates, the calculated field updates with it.
You need a calculated field when you want to show something the raw data doesn't contain — like profit margin (revenue minus cost, divided by revenue), commission on sales, or the percentage of a total. The calculated field lives inside the pivot table and moves with it when you rearrange rows and columns.
The alternative is to add a formula in a helper column next to the pivot table, but that breaks when you refresh the data or change the pivot table layout. A calculated field stays connected to the pivot table itself.
Key Takeaways
- Calculated fields work in Excel and Google Sheets, but the steps differ between them — Excel uses the PivotTable Analyze tab, Google Sheets uses the Data menu.
- You can only calculate based on the numeric fields already in your pivot table, not on raw data outside it.
- The calculated field appears as a new row or column in your pivot table and updates automatically when you refresh the data.
- If your formula references a field that contains text or blank cells, the calculation may return an error for those rows.
Adding a calculated field in Excel
Open your pivot table in Excel. Click anywhere inside the pivot table to select it. At the top of the screen, find the PivotTable Analyze tab (or PivotTable Tools depending on your Excel version) and click it.
In the ribbon, look for the Fields, Items & Sets button (or sometimes labeled Calculations). Click the dropdown arrow next to it and select Calculated Field. A dialog box will open.
In the dialog, type a name for your field in the NameFormula'Revenue' - 'Cost'. Click OK when you're done.
Excel adds your calculated field to the pivot table. It will appear as a new column (if you're calculating across rows) or a new row (if you're calculating down columns). The field updates whenever you refresh the pivot table.
Adding a calculated field in Google Sheets
Open your pivot table in Google Sheets. Click anywhere inside the pivot table. At the top menu, click Data, then scroll down and click Pivot table. This opens the pivot table editor panel on the right side of the screen.
In the pivot table editor, scroll down to the Values section. Click the Add button (the plus sign). A dropdown menu appears — select Calculated field at the bottom of the list.
A new panel opens where you name your field and write the formula. Type a name like "Profit Margin" in the Calculated field nameRevenue - Cost. Click Insert when finished.
Google Sheets adds the calculated field to your pivot table. It appears as a new column in the Values section and recalculates whenever the pivot table updates.
Common mistakes that cause errors
The most common mistake is trying to reference a field that doesn't exist in your pivot table. If you type 'Sales Amount' but your actual field is called 'Total Sales', the formula will fail. Check the exact spelling and capitalization of every field name you reference.
Another frequent problem is including text fields in your calculation. If a field contains words or blank cells, the formula may return an error for those rows. Calculated fields work best when you're doing math on numbers only. If you need to calculate based on text (like counting how many times a word appears), use a helper column outside the pivot table instead.
In Excel, forgetting to put field names in single quotes will cause an error. The correct format is 'Field Name' - 'Another Field', not Field Name - Another Field. Google Sheets is more forgiving about this, but it's still good practice to be consistent.
Where the calculated field appears in your pivot table
The location depends on how your pivot table is structured. If you're calculating a new metric from existing values (like profit from revenue and cost), the calculated field usually appears as a new column at the right end of your data values. If you're calculating something that should appear as a row, you may need to drag it to the Rows area in the pivot table editor.
You can move a calculated field around just like any other field. In Excel, drag it in the pivot table itself or use the field list. In Google Sheets, drag it within the Values section of the pivot table editor. The calculation stays the same — only the position changes.
If the calculated field doesn't appear where you expect, check the pivot table editor (the panel on the right in Google Sheets, or the field list in Excel) to see which section it's assigned to. Move it to the section that makes sense for your layout.
Editing or deleting a calculated field
To change the formula, go back to where you created it. In Excel, click inside the pivot table, go to PivotTable Analyze, click Fields, Items & Sets, and select Calculated Field again. Your existing calculated fields will appear in the list — click the one you want to edit and change the formula in the dialog box.
In Google Sheets, click inside the pivot table, open the pivot table editor on the right, find your calculated field in the Values section, click the three-dot menu next to it, and select Edit. Change the formula and click Update.
To remove a calculated field entirely, follow the same steps but select Delete instead of Edit. The column or row disappears from the pivot table, but your original data is unaffected.
When a calculated field won't work for what you need
Calculated fields have limits. You can only reference fields that are already in your pivot table — you cannot pull in data from outside it. If you need to calculate based on raw data that isn't in the pivot table, add a helper column to your original data first, then rebuild the pivot table to include it.
You also cannot use calculated fields to filter or group data — they're for displaying new numbers, not for changing how the pivot table is organized. If you need to group sales by profit range or filter by a calculated value, you'll need a different approach, like adding a helper column in your source data.
If your calculation is very complex or involves conditional logic (like "if revenue is above 10,000, multiply by 1.2, otherwise multiply by 1.1"), a calculated field may not be the right tool. In those cases, add the formula to your original data before creating the pivot table.
Frequently Asked Questions
Can I use a calculated field to divide one pivot table value by another?
Yes. If your pivot table has a Revenue column and a Units column, you can create a calculated field with the formula 'Revenue' / 'Units' to show revenue per unit. The formula updates automatically when you refresh the pivot table.
What happens to my calculated field when I refresh the pivot table?
The calculated field stays in place and recalculates based on the new data. If you've added or removed rows in your source data, the calculated field applies to all rows in the refreshed pivot table. The formula itself does not change unless you edit it.
Can I use a calculated field in both Excel and Google Sheets the same way?
The concept is the same, but the steps are different. Excel uses the PivotTable Analyze tab and a dialog box, while Google Sheets uses the Data menu and the pivot table editor panel. The formulas work similarly, but Google Sheets is more flexible about syntax — it doesn't require single quotes around field names.
Why does my calculated field show an error for some rows?
This usually happens when one of the fields you're referencing contains text, blank cells, or non-numeric data in some rows. The calculation works for rows with numbers but fails for rows with text. Check your source data to see if any cells in those fields are empty or contain words instead of numbers.
Can I create a calculated field that counts or sums based on a condition?
Not directly in a calculated field — they perform simple math on existing values. If you need conditional logic (like summing only values above a certain amount), add a helper column to your original data with an IF formula, then include that column in your pivot table.