Sub topic 2
Preparing Source Data: One Header Row, One Record Per Row
A PivotTable is only as reliable as the data behind it. This chapter covers the layout Excel expects, the mistakes that break it, and a quick check to run before you insert a PivotTable. It assumes you can move around a workbook, enter data, and select ranges.
The Shape a PivotTable Needs
Excel reads your source as a flat table. Each column is one field, such as Region or Sales. Each row after the header is one record, such as a single sale. The first row holds the field names, and every row below it holds data.
Here is a small dataset in that shape:
Date,Region,Product,Units,Sales
2025-01-05,East,Widget,10,250
2025-01-12,West,Gadget,4,180
2025-02-03,East,Gadget,7,315
2025-02-14,West,Widget,12,300
2025-03-09,East,Widget,5,125Each field name becomes an item in the PivotTable Fields pane. Each record contributes one row of values to the summary.
Rules for Clean Source Data
- Use exactly one header row. Put it at the top of the data. Do not split a header over two rows or merge header cells.
- Give every column a unique, non-empty header. A blank header causes an error when you create the PivotTable. Duplicate headers get a number added, such as Sales2.
- Keep one record per row. Do not spread one record across several rows, and do not repeat a month as separate columns like Jan, Feb and Mar.
- Store one kind of value per column. A Units column should hold only numbers. A single text entry such as "n/a" can make Excel treat the whole column as text.
- Fill every cell in the category columns. Do not leave a Region blank because it matches the row above. Blank cells become a "(blank)" item in the PivotTable.
- Leave out totals and subtotals. A total row in the source gets counted as another record and doubles your results.
- Keep other content away from the data. Surround the data with empty cells, or place it on its own sheet, so Excel finds its edges correctly.
Wide Versus Long Layouts
A report often lists months across the columns. That is a wide layout. A PivotTable needs a long layout, where Month is one column and each month's figure is a separate row.
| Wide (hard to pivot) | Long (pivot-ready) |
|---|---|
| Region, Jan, Feb, Mar | Region, Month, Sales |
| One row per region | One row per region and month |
With the long layout you can filter, group and chart by Month. With the wide layout, every month is a separate field.
A Quick Check Before You Pivot
Click one cell inside the data and press Ctrl+A. Excel selects the current region, which is the block of connected data. If the highlight covers exactly your data, with no extra rows or stray columns, the source is ready. If it stops early or includes a total row, look for a blank row, a blank column, or a leftover total.
Exercise
A sales sheet has the columns Region, Jan, Feb and Mar, plus a Total row at the bottom. Name two changes that make it suitable as a PivotTable source.
Show answer
Remove the Total row, because the PivotTable would count it as a record. Reshape the data into a long layout with the columns Region, Month and Sales, so that each region and month combination is its own row.