Google Sheets Pivot Table Calculated Field Guide

Charts & pivot tables · Updated November 23, 2026

In Google Sheets, a calculated field is a custom formula you add to a pivot table that computes values from other fields in the pivot’s underlying data, such as summing sales per unit or finding a percentage difference. You add it via the pivot table editor under “Values” > “Add” > “Calculated field,” where you write a formula using the names of your source columns (e.g., Sales / Units) and choose a summary type like SUM or AVERAGE.

What a Calculated Field Actually Does

A calculated field works on the aggregated data inside the pivot table, not on the raw rows. When you write Sales / Units, Sheets first groups rows by your row/column dimensions, then sums Sales and Units for each group, and only then divides the two sums. That is different from creating a helper column in the source data (e.g., =B2/C2 per row) and then summing that column, because a helper column sums the per-row ratios, which can give a different result when group sizes vary.

For example, if you have two rows: Sales 100, Units 5 (ratio 20) and Sales 200, Units 20 (ratio 10), the calculated field SUM(Sales)/SUM(Units) returns 300/25 = 12. A helper column that sums 20 + 10 = 30 and then averages would give 15. Both are valid, but they answer different questions. Calculated fields always operate on the aggregate, so they are ideal for weighted averages, profit margins, or per-unit metrics.

How to Add a Calculated Field (Step by Step)

Assume your source data has columns: Product (A), Region (B), Sales (C), Units (D).

  1. Select your data range (e.g., A1:D100) and go to Insert > Pivot table.
  2. In the pivot table editor (right side), add Product to Rows and Region to Columns (or just Rows if you want a simple list).
  3. Under Values, click Add and choose Calculated field.
  4. In the formula box, type =Sales/Units (no equals sign is required, but it works either way).
  5. In the “Summarize by” dropdown, choose SUM (or AVERAGE, COUNT, etc.). The default is usually SUM, which is correct for division formulas.
  6. Click Add and close the editor. The calculated field appears as a new column in your pivot.

If you want to rename the field, click the field name in the Values list, then click the pencil icon and type a custom name like “Avg Price per Unit.”

Formula Syntax and Rules

Calculated field formulas use standard Google Sheets operators and functions, but with a few quirks:

  • Reference fields by their exact header name (case-insensitive). If a header has spaces, use single quotes: 'Unit Price'.
  • You cannot reference individual cells (like A2) or ranges; only field names and constants are allowed.
  • You can use functions like SUM, AVERAGE, COUNT, IF, and arithmetic operators. For example, =IF(Sales>1000, Sales*0.1, 0) gives a 10% bonus only on sales above 1000.
  • Calculated fields cannot reference other calculated fields in the same pivot. You must duplicate the logic or create a second calculated field.
  • When you use a function like SUM inside a calculated field, it applies to the aggregated value of that field for the group, not to individual rows. So =SUM(Sales)/SUM(Units) is the same as =Sales/Units because the pivot already sums the fields before the formula runs.

Common Use Cases and Examples

Here are three typical scenarios with actual formula examples:

1. Profit margin percentage: If you have Profit and Sales fields, use =Profit/Sales and set the number format to percent (Format > Number > Percent). This gives the margin per group.

2. Weighted average price: With Sales and Units, use =Sales/Units to get the average price per unit, weighted by the number of units sold. This is the correct way to avoid the helper-column pitfall.

3. Conditional counting: To count only orders above a threshold, use =COUNTIF(OrderAmount, ">100") – but note that COUNTIF works on the aggregated field values, not raw rows. If you need row-level conditions, you must filter the source data or use a helper column.

Calculated Field vs. Helper Column: Which to Use?

Many users wonder whether to add a calculated field or just create an extra column in the source data. The choice depends on your goal:

  • Calculated field is best when you want the result to update automatically as you change pivot filters, rows, or columns, and when you want to avoid cluttering your source data. It always respects the pivot’s grouping.
  • Helper column is better when you need a row-level calculation (like a per-item discount that depends on other columns) that you also want to use outside the pivot, or when you need to filter on that calculated value before aggregating. However, a helper column sums the per-row results, which may not be what you want for ratios.

If you need to filter the pivot based on a calculated value (e.g., only show groups where margin > 20%), you cannot do that directly with a calculated field. You would need to add the calculated field as a value, then copy the pivot and filter manually, or use a helper column in the source.

Common Problems and Fixes

“Formula is invalid” error: This usually means you referenced a field name that doesn’t exist, or you used a cell reference like A1. Check the spelling and ensure field names are in single quotes if they contain spaces.

Wrong results (e.g., totals are off): Remember that calculated fields operate on aggregated values. If you expected row-level division and then sum, you’ll get a different number. Re-read the “What a Calculated Field Actually Does” section above.

Can’t reference another calculated field: This is a limitation. If you need Field1 / Field2 where both are calculated, combine the logic into one formula, e.g., =(Sales/Units) / (Cost/Units).

Number formatting not applying: After adding the calculated field, select the values in the pivot and use Format > Number > Currency or Percent. Sometimes you need to click on the value cell and apply formatting manually.

Frequently Asked Questions

Can I use a calculated field to filter rows in the pivot? No. Calculated fields only add values; they cannot be used as filters. To filter based on a calculation, you must create a helper column in the source data and filter on that.

Why does my calculated field show the same total for every row? If you don’t add any row or column dimensions, the pivot has only one grand total group, so the calculated field returns that single value. Add a dimension (e.g., Product) to Rows to get per-product values.

Can I use a calculated field in a chart? Yes, charts built from a pivot table will include the calculated field as a series, but you may need to refresh the chart after adding the field.

Does the calculated field update when I change the source data? Yes, pivot tables automatically recalculate when source data changes, but you may need to click Refresh (or wait a few seconds) if you have many rows.

Is there a limit to the number of calculated fields? No hard limit, but performance can degrade with many complex formulas. Keep formulas simple and avoid volatile functions like NOW().

Alternatives and Advanced Options

If calculated fields feel restrictive, consider these alternatives:

  • QUERY function: Write a SQL-like query on the raw data, e.g., =QUERY(A1:D100, "select A, sum(C)/sum(D) group by A"). This gives you more control and can include calculated columns directly.
  • Array formulas: Use ARRAYFORMULA to create a helper column that computes row-level values, then pivot on that.
  • Google Sheets Add-ons: Some add-ons (like Power Tools) offer advanced pivot features, but they are not built-in and may have costs.

For most users, the built-in calculated field is sufficient. Just remember the key rule: it operates on aggregates, not rows. That one insight will save you from most confusion.

Related

Try it: the Percentage Formula Generator: percent of, percent change, increase and decrease, with the formula.

More in Charts & pivot tables

Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources

Spotted an error in this guide? Let us know.