FormulaCraft

How to write formulas for a pivot table calculated field in Excel and Google Sheets

Topic:Pivot-style summaries (formula approach)
Excel & Google Sheets
=SUMIFS(C2:C7,A2:A7,"East",B2:B7,"Q1")/SUMIFS(D2:D7,A2:A7,"East",B2:B7,"Q1")

Verified example

Computed by a real spreadsheet engine on the sample data below.

RegionQuarterRevenueUnits
EastQ1500020
EastQ1300015
WestQ1400010
EastQ2600025
WestQ220008

=SUMIFS(C2:C7,A2:A7,"East",B2:B7,"Q1")/SUMIFS(D2:D7,A2:A7,"East",B2:B7,"Q1")228.5714285714

Try it with your data

Edit the grid or formula, then run it through a real spreadsheet engine — no signup.

Sample data — click any cell to edit

Runs server-side · free · no signup

Step by step

  1. 1List your flat data in columns: A = Region, B = Quarter, C = Revenue, D = Units (rows 2-7).
  2. 2Decide the calculated metric — for example, Revenue per Unit = Revenue / Units.
  3. 3In a summary cell, write =SUMIFS(C2:C7,A2:A7,"East",B2:B7,"Q1") to get total revenue for East/Q1.
  4. 4Divide by a matching SUMIFS on D2:D7 to get the aggregated Revenue per Unit ratio.
  5. 5Replace the hardcoded strings with cell references in a summary table to replicate pivot-like row/column headers.

Tips

Need it for your exact data?

Describe your columns in plain English and get the precise formula for your sheet, with the right Excel or Sheets syntax.

Frequently asked

Why doesn't my calculated field give the same result as dividing two columns manually?

Pivot calculated fields operate on aggregate sums, not on each row. Revenue/Units in a calculated field computes SUM(Revenue)/SUM(Units), which differs from SUM(Revenue/Units).

Can I reference an external cell in a pivot calculated field?

No. Calculated fields can only reference other pivot fields by name. If you need an external value, use a SUMIFS formula outside the pivot instead.

Does Google Sheets support calculated fields in pivot tables?

Yes, but with fewer formula functions than Excel. The SUMIFS approach works in both without any restrictions.

More on Pivot-style summaries (formula approach)

See all →

Formulas used

Written and reviewed by FormulaCraft Team. Each formula on this page is run through our verification engine before publishing.

Last reviewed: