What a calculated field does in a pivot table
A calculated field is a new column or row you create inside a pivot table that performs math on the data already there. Instead of manually adding numbers in a separate cell, you define a formula once, and the pivot table applies it to every row or group automatically. The result appears as a new field alongside your existing data.
The most common use is creating a new metric from existing ones — for example, turning revenue and units sold into revenue per unit, or taking two expense categories and showing their ratio. Once you add the calculated field, it updates whenever you refresh the pivot table.
Key Takeaways
- Calculated fields work in Excel and Google Sheets pivot tables, but the steps differ slightly between them.
- You reference other fields in your formula by their exact names in quotes, not by cell letters.
- The calculated field applies to every row in the pivot table, so test your formula on one row first if you are unsure.
- If your formula references a field that is not already in the pivot table, you must add that field first before creating the calculation.
How to add a calculated field in Excel
Open your pivot table and click anywhere inside it. Go to the PivotTable Analyze tab (or PivotTable Tools depending on your Excel version), then click Fields, Items, & Sets and select Calculated Field. A dialog box opens asking for a name and a formula.
Type a name for your new field — something like "Revenue Per Unit" or "Margin Percent". Then in the Formula box, write your calculation using field names in single quotes. For example, if your pivot table has fields called "Revenue" and "Units", you would type 'Revenue'/'Units' to divide one by the other. Click OK and the field appears in your pivot table immediately.
If the result looks wrong, right-click the calculated field name in the PivotTable Fields pane on the right, select Edit, and adjust the formula. You can also delete it from there and start over.
How to add a calculated field in Google Sheets
Click anywhere in your pivot table, then open the Data menu and select Pivot table, then Edit pivot table. The pivot table editor panel opens on the right. Scroll down to Values and click the Add button (the plus sign). Choose Calculated field from the dropdown.
Name your field and then build the formula using the field picker. You can click on field names from the list, and Google Sheets inserts them with the correct syntax automatically. For division, multiplication, addition, or subtraction, type the operator between fields. For example, clicking "Revenue", then typing "/", then clicking "Units" creates the formula 'Revenue'/'Units'. Click OK when done.
Google Sheets adds the calculated field to the Values section of your pivot table. If you need to change it later, click the calculated field name in the Values list and select Edit.
When you need to add the source fields first
A calculated field can only reference fields that already exist in your pivot table. If you want to create a formula using "Profit" but "Profit" is not currently shown in your table, you must add it to the Values area first, even if you do not want to see it in the final result.
Once the field is in the Values area, create your calculated field. Then, if you do not want the original field visible, you can remove it from the Values area — your calculated field will still work because it already has the data it needs.
Formatting and positioning your calculated field
After you create a calculated field, it appears as a new column (or row, depending on your pivot table layout) with the default number format. In Excel, right-click the calculated field values and select Format Cells to change decimal places, currency symbols, or percentage display. In Google Sheets, click the calculated field in the Values section, select Summarize by, and choose a format option.
To move the calculated field to a different position in your pivot table, drag it within the Values area in the pivot table editor. The order you arrange fields there determines the order they appear left to right (or top to bottom) in the finished table.
Common formulas and what they do
Division is the most frequent calculation: 'Revenue'/'Units' gives you revenue per unit. Subtraction works for differences: 'Actual'−'Budget' shows variance. Multiplication scales values: 'Price'*'Quantity' calculates total cost. Percentages use division: 'Profit'/'Revenue' gives profit margin as a decimal (multiply by 100 in formatting if you want it to display as a whole number).
You can also nest operations: ('Revenue'−'Cost')/'Revenue' calculates margin in one step. Keep formulas simple enough that you can explain them to someone else — complex nested calculations become hard to debug if the result looks wrong.
Troubleshooting calculated fields that show errors or zeros
If your calculated field shows #DIV/0! or #VALUE!, the formula has a syntax error or is trying to divide by zero. Check that field names are spelled exactly as they appear in your pivot table, including capitalization and spaces. In Excel, field names must be in single quotes; in Google Sheets, the field picker handles this automatically.
If the result is zero or blank when you expected a number, the source fields may contain text instead of numbers, or the data may be filtered in a way that hides values. Verify that the fields you are referencing contain actual numbers by clicking on them in the pivot table and checking the original data source.
Frequently Asked Questions
Can I use a calculated field to reference cells outside the pivot table?
No. Calculated fields only work with other fields inside the same pivot table. If you need to reference external data, create a helper column in your source data, add that column to the pivot table, and then build your calculated field from it.
What happens to a calculated field when I refresh the pivot table?
The calculated field stays in place and recalculates using the updated data. If the source fields change, your calculated field updates automatically. If you delete a source field that your calculated field depends on, the calculated field will show an error until you fix the formula.
Can I use calculated fields in both rows and values at the same time?
Yes. You can add a calculated field to the Values area and also add it to the Rows or Columns area if your pivot table layout supports it. This is useful when you want to see the calculated value grouped by category.
How do I copy a calculated field to another pivot table?
You cannot copy a calculated field directly between pivot tables. You must recreate it in the new table using the same formula. Write down the formula name and the exact calculation so you can rebuild it quickly in the second pivot table.
Can I use IF statements or other functions inside a calculated field?
Excel calculated fields do not support IF, SUMIF, or other conditional functions — only basic arithmetic. Google Sheets has the same limitation. If you need conditional logic, create a helper column in your source data with an IF formula, add that column to the pivot table, and build your calculated field from it.