Excel · Summarising

Pivot Tables & the formulas behind them

A Pivot Table is a drag-and-drop SUMIFS. Learn both and you can answer "summarise this data" two ways, and check one against the other.

Your win todayTurn an 8-row sales table into a Region × Product revenue summary with a pivot, then reproduce one cell with SUMIFS.

The data

A DateB RegionC RepD ProductE UnitsF Revenue
205-JanNorthAshaLaptop2120000
309-JanSouthRaviPhone575000
415-JanNorthAshaPhone345000
502-FebEastMeeraLaptop160000
611-FebSouthRaviLaptop2120000
720-FebNorthJohnPhone460000
803-MarEastMeeraPhone690000
918-MarSouthFatimaLaptop3180000

The source data needs a single header row and no blank rows or columns.[MS] Pro move: press Ctrl+T to make it a Table first, so new rows join the pivot when you refresh.

Four boxes: where each field goes

FIELD LIST Rep Product Region Revenue FILTERSRep (optional) COLUMNSProduct ROWSRegion VALUESSum of Revenue RESULT Sum of Revenue LaptopPhoneTotal East6000090000150000 North120000105000225000 South30000075000375000 Grand Total480000270000750000 Highlighted cell = SUMIFS(F2:F9, B2:B9,"South", D2:D9,"Laptop") Rows field → one row per Region. Columns field → one column per Product. Values → what's aggregated (Sum, Count, Average…). Filters → slice the whole table (e.g. only Rep = Ravi).
Excel's defaults: text fields go to Rows, dates to Columns, and numbers to Values. You can drag any of them elsewhere.[MS] Every value cell is a SUMIFS with the row and column labels as its criteria.

Pivot facts interviewers check

The basic formulas you must know cold

FormulaDoesOn this data
SUM / AVERAGE / MIN / MAXThe obvious=SUM(F2:F9) → 750000
COUNT vs COUNTACOUNT = numeric cells only; COUNTA = all non-empty cells=COUNT(B2:B9) → 0 · =COUNTA(B2:B9) → 8
SUMIF(range, criteria, sum_range)Sum with one condition=SUMIF(B2:B9,"North",F2:F9) → 225000
SUMIFS(sum_range, crit_range1, crit1, …)Sum with many conditions. sum_range comes first!=SUMIFS(F2:F9,B2:B9,"South",D2:D9,"Laptop") → 300000
COUNTIFS(crit_range1, crit1, …)Count rows meeting conditions=COUNTIFS(D2:D9,"Laptop") → 4
AVERAGEIFS(avg_range, crit_range1, crit1, …)Average with conditions=AVERAGEIFS(F2:F9,B2:B9,"East") → 75000
IF(test, if_true, if_false)Branch=IF(F2>=100000,"Big","Small")
IFERROR(value, value_if_error)Replace any error (#N/A, #DIV/0!) with something clean=IFERROR(VLOOKUP(G2,A2:F9,6,FALSE),"Not found")
TRIM / LEFT / RIGHT / MID / LENClean and slice text=LEFT("E103",1) → E
CONCAT or &Join text=C2&" - "&B2 → Asha - North

Syntax as documented by Microsoft for SUMIFS and IFERROR.

Classic trapSUMIF puts the sum range last. SUMIFS puts it first. Interviewers ask this on purpose.
Say it in the interview"A Pivot Table summarises a flat table by dragging fields into Rows, Columns, Values and Filters. I keep the source as an Excel Table so a Refresh picks up new rows. When I need the summary inside a model or report, I use SUMIFS or COUNTIFS. Each pivot cell is really a SUMIFS with the row and column labels as its criteria, so I can cross-check one against the other."

Retrieval check

Rows = Region, Columns = Product, Values = Sum of Revenue. What's in South × Laptop?

You add 50 new rows to the source and the pivot doesn't change. Why?

What does COUNTA count?

Which SUMIFS is written correctly?

What does =IFERROR(VLOOKUP(…), "Not found") do?

Type it

Write a formula for total North revenue.

Count how many South Laptop sales there were.

Your turn

Go deeper

Primary source: Microsoft Support: Create a PivotTable to analyze worksheet data. Then SUMIFS function.

Related: Lesson 2 · Lesson 5: GROUP BY is SQL's pivot · Excel cheat sheet

💬 Ask your teacher: "give me a messy dataset to pivot" or "what's a calculated field?"