Keyboard Shortcuts N Next post
P Previous post
S Save / unsave
R Read aloud
T Toggle theme
/ Focus search
Esc Close panels
🔥
Ready to read...
Data Analytics Course Excel Phase 3 — Spreadsheet Analytics pivot tables spreadsheets

Pivot Tables in Excel — Turn Raw Data Into Insights

Reviewed & accurate
AI Summary

What You Will Learn

  • What a pivot table is and why it is the most powerful Excel feature
  • How to build one step by step with real data
  • How to group, filter, and drill down
  • How to reproduce pivot-table thinking in SQL and pandas

Why This Topic Matters

If you only learn one advanced Excel feature, make it pivot tables. A pivot table can summarize 100,000 rows of raw data into a clean report in three clicks — without writing a single formula. Every SQL GROUP BY and pandas groupby you will write later is essentially a pivot table in code form. Once you understand pivot tables, those coding concepts become obvious.

The Sample Dataset

Imagine 12 rows of order data:

order_iddatecustomercityproductamount
12026-08-01AnitaMumbaiLaptop50000
22026-08-02RaviChennaiMouse500
32026-08-03MiraKolkataLaptop60000
42026-08-04AnitaMumbaiMouse500
52026-08-05RaviChennaiKeyboard1500
62026-08-06SamMumbaiLaptop55000
72026-08-07MiraKolkataMouse500
82026-08-08AnitaMumbaiKeyboard1500
92026-08-09RaviChennaiLaptop52000
102026-08-10SamMumbaiMouse500
112026-08-11MiraKolkataKeyboard1500
122026-08-12AnitaMumbaiLaptop51000

With 12 rows you can read it by eye. With 12,000 rows, you cannot. Pivot tables solve this.

Build Your First Pivot Table

  1. Select any cell inside the data.
  2. Go to Insert → PivotTable. Excel auto-detects the range.
  3. Choose "New Worksheet" and click OK.
  4. A blank pivot table appears, with a "PivotTable Fields" panel on the right.

The four drop zones

ZoneWhat it does
FiltersTop-level filter (e.g., show only one city)
RowsValues that go down the left side (group by these)
ColumnsValues that go across the top (secondary grouping)
ValuesThe numeric measure being aggregated

Example 1 — Total Revenue by City

  1. Drag city to the Rows zone.
  2. Drag amount to the Values zone.

Result:

Row LabelsSum of amount
Chennai54000
Kolkata62500
Mumbai159000
Grand Total275500

Three clicks. No formulas. The same calculation in SQL would be SELECT city, SUM(amount) FROM orders GROUP BY city — see lesson 21.

Example 2 — Revenue by City and Product

  1. Keep city in Rows.
  2. Drag product to Columns.
  3. amount stays in Values.

Result:

KeyboardLaptopMouseGrand Total
Chennai15005200050054000
Kolkata15006000050062500
Mumbai15001560001000159000
Grand Total45002680002000275500

Now you can see at a glance: Mumbai leads in laptop revenue. Chennai has the smallest share across all categories.

Example 3 — Average Order Value by Customer

  1. Drag customer to Rows.
  2. Drag amount to Values.
  3. Click the "Sum of amount" field in Values → "Value Field Settings" → change from Sum to Average.

Result:

Row LabelsAverage of amount
Anita34250
Mira20750
Ravi18000
Sam27750

Anita's average is high because she orders laptops. Mira's mix of laptops + accessories gives a middle average. Sam's average is dragged up by two laptop orders.

Example 4 — Count of Orders per Customer

  1. Drag customer to Rows.
  2. Drag order_id to Values.
  3. Change Value Field Settings to Count.

Result: Anita 4, Mira 3, Ravi 3, Sam 2. Now you can compute orders per customer — a basic retention metric.

Drilling Down — Grouping by Date

If you drag the date field to Rows, Excel groups by individual date. Right-click any date → Group. Choose "Months" or "Quarters" to roll up the time dimension. This is how analysts build monthly trend reports without writing a single formula.

Filtering Inside a Pivot Table

  1. Drag city to the Filters zone (above the table).
  2. A dropdown appears at the top of the pivot sheet.
  3. Select "Mumbai" → the entire pivot updates to show only Mumbai data.

This is the cleanest way to make a "filter by region" report.

Slicers — Visual Filters

PivotTable Analyze → Insert Slicer creates clickable buttons for filtering. Slicers are easier for non-Excel users to operate than dropdowns and look much better in dashboards. We use them in lesson 16 — Build a Dashboard.

The Mental Model: Pivot = Group + Aggregate

A pivot table is just two operations combined:

  1. Group rows by one or more dimensions (city, product, customer).
  2. Aggregate a numeric measure within each group (SUM, AVERAGE, COUNT, MIN, MAX).

That is it. Every pivot table in the world is some combination of grouping and aggregating. SQL calls this GROUP BY + an aggregation function. pandas calls it groupby().agg(). The concept is universal.

Common Mistakes

  1. Forgetting to refresh. If the source data changes, the pivot does not auto-update. Right-click → Refresh, or press Alt+F5.
  2. Using text in the Values zone. Excel will count text fields (which can be useful) but cannot sum them.
  3. Not formatting numbers. A pivot showing "159000" is harder to read than "1,59,000". Right-click → Number Format → set thousands separator.
  4. Putting too many fields in Rows. A pivot with 4 row fields becomes unreadable. Use at most 2.
  5. Source data not formatted as a table. If you add rows below the original range, the pivot will not include them. Convert your data to an Excel Table (Ctrl+T) first, and the pivot will auto-extend.

Practical Exercise (15 minutes)

Recreate the 12-row sample data above in a fresh spreadsheet.

  1. Build a pivot showing total revenue by product.
  2. Add city as a column. Which city has the highest laptop revenue?
  3. Change the aggregation from Sum to Average. How does the picture change?
  4. Add a filter for customer = "Anita". Compare her spending across products.
  5. Group the date field by week. How many orders each week?

Mini Challenge

Download any real CSV — for example, a small Kaggle sales or e-commerce dataset. Build three pivot tables that answer three different business questions about it. Write each question above its pivot. This is what real analysts do every day: question first, pivot second.

Key Takeaways

  • A pivot table = group by dimensions + aggregate a measure. No formulas needed.
  • Four zones: Filters, Rows, Columns, Values.
  • Value Field Settings lets you switch between Sum, Average, Count, Min, Max.
  • Always refresh the pivot after the source data changes.
  • Convert source data to an Excel Table so the pivot auto-extends when rows are added.
Course continuity
Previously learned: Lessons 12, 13, 14 covered sorting/filtering, formulas, and VLOOKUP.
Today: You learned pivot tables — the most powerful point-and-click analysis tool in Excel.
Next: Lesson 16 shows you how to combine pivot tables with charts and slicers into a real dashboard.

FAQ

Why does my pivot show "Count of amount" instead of "Sum of amount"?

Because Excel saw at least one text or blank value in the amount column and decided Count was safer. Right-click the field → Value Field Settings → change to Sum. Also clean the source column so it contains only numbers.

Can a pivot table reference multiple sheets?

Yes, via the "Data Model" feature (Power Pivot). It lets you build relationships between tables, similar to SQL JOINs. For simple needs, just use VLOOKUP to bring columns into one sheet first.

Test Your Knowledge
How did you find this?

Comments

Join the discussion! Sign in with your Google or Blogger account, or comment as Anonymous - no account needed. For quick questions, also reach me on Telegram @cytestch.

Comments