Preparing a pivot table means arranging your source data so that spreadsheet software can group and total it, then dropping those fields into Rows, Columns, Values and Filters. The fastest reliable version is: give every column a single unique header, keep one row per record, leave no blank rows or columns inside the table, and convert the range to a Table (or named range) so new rows are picked up automatically. Do that and INSERT > PivotTable in Excel or Data > Pivot table in Google Sheets will work on the first try. Most pivot table failures are data layout problems, not pivot table problems.
What You'll Need
- Your data in one sheet, with the header row directly above the first data row (no title banner, no blank row, no merged cells).
- One column per variable, one row per record. Dates in real date cells, numbers in real number cells, not text.
- Spreadsheet software that supports pivot tables: Excel for Windows or Mac, Google Sheets, or LibreOffice Calc.
- A clear idea of the question you want answered - total by category, count by month, average by region - because that decides which field goes in Values.
- Optional but useful: a unique ID column, and a helper column for anything you want to group differently (for example a month name or a size band).
Step-by-Step
- Clean the header row first. Every column needs a short, unique name with no line breaks and no trailing spaces. Duplicate headers make the tool add a number or refuse the range, so rename anything like "Sales" and "Sales ". Empty header cells are the single most common cause of an error message.
- Remove the blank clutter. Delete blank rows and columns inside the data, remove subtotal or "Total" rows that sit inside the list, and unmerge any merged cells. Pivot tables treat a blank row as the end of the data, so anything below it silently disappears from the results.
- Make each column one data type. Check that dates are recognised as dates (they should align right by default) and numbers as numbers. Text that looks like a number - imported currency symbols, stray apostrophes, spaces - will be counted instead of summed. Convert it before you build anything.
- Decide about totals and empty cells. If a numeric column legitimately has no value, leave it empty rather than typing 0 or "N/A", unless you want the average to include a zero. Typing \"n/a\" in a number column turns the whole column into text.
- Turn the range into a Table. In Excel, click any cell in the data and choose INSERT > Table, keeping \"My table has headers\" ticked. In Google Sheets you can instead just select the range; Sheets handles expanding ranges well, but a named range keeps things tidy. Menu and ribbon labels vary slightly by version, device and region, so look for the equivalent wording if you do not see exactly this path.
- Insert the pivot table. Excel: with a cell in the table selected, go to INSERT > PivotTable and choose New Worksheet. Google Sheets: Data > Pivot table, then choose whether to place it in a new or existing sheet. LibreOffice uses Data > Pivot Table > Insert or Edit.
- Put the grouping field in Rows. Drag the field you want to break the data down by - Region, Product, Category - into the Rows area. The list immediately collapses thousands of rows into a short set of labels with collapsible groups.
- Put the comparison field in Columns, or skip it. A date or second category in Columns creates a grid: rows down the side, months or segments across the top. If you only want a simple list, leave Columns empty - a crowded pivot is harder to read than two pivots.
- Put the number you care about in Values. Text fields default to Count, numeric fields to Sum. Change the summary if needed: right-click a value in Excel and choose Summarize Values By, or in Google Sheets click the value field's drop-down and pick Summarize by > AVERAGE, COUNT or COUNTA. Use COUNTA to count non-empty text rows, COUNT for numbers only.
- Add filters for anything you do not want to see. Drop a field into Filters (Excel) or Filter (Sheets) to slice the whole pivot from one control - for example, one year or one salesperson at a time. Use the row/column label drop-downs to hide individual items instead.
- Format and verify the numbers. Apply a number format to the Values area rather than the individual cells, so it survives refreshes. Then check one total by hand: filter the source data to a single group and compare the sum or count.
- Refresh when the source data changes. Excel does not update a pivot automatically when you type in the source - right-click inside it and choose Refresh, or use Data > Refresh All. Google Sheets pivot tables generally recalculate on their own.
Common Mistakes
- Blank rows or a stray total row inside the data range - everything below them is excluded.
- Merged cells in the header or in the rows area; merged cells confuse both the range detection and the grouping.
- Numbers stored as text, which is why a Values field shows Count of Amount instead of Sum of Amount.
- Inconsistent labels: "North", "north" and " Nothern" become three separate groups. Standardise spelling and casing first.
- Dates stored as text, so Excel and Sheets create a separate group for every day instead of letting you group by month.
- Putting raw data and the pivot on the same rows, so the pivot overwrites data when it resizes.
- Two headers stacked in one cell, like "Revenue 2025" with years and months combined - the field cannot be split later.
Tips
- Add a helper column in the source for anything you group repeatedly: a month name, a quarter, a price band. Formula-driven labels stay in step with the data.
- Group dates in the pivot itself where supported: right-click a date label in Excel and choose Group to roll days into months, quarters or years.
- Use a table rather than a fixed range, so rows added later are included after a refresh.
- Keep the source data on its own sheet and put each pivot on a fresh sheet - resizing and filtering is much safer.
- Show values as percentages (right-click > Show Values As, or the value field's drop-down) to see share of total rather than raw totals.
- Rename value headers from "Sum of Amount" to something readable by typing over the header cell or using the field settings.
Troubleshooting
"Data source reference is not valid" or the tool will not accept the range. Close any open dialog, click a single cell inside the data, then reinsert. Usually the range was typed by hand or included a header row on another sheet.
The pivot is missing recent rows. The range was fixed and new rows landed outside it. Convert the source to a Table and refresh, or expand the range via the pivot's Change Data Source option.
Values show as counts instead of totals. The column contains text or blanks. Find the offending cells, convert them to numbers, and change the field to Sum.
Dates form one group per day. Either the column is stored as text (fix the format) or grouping is off. Right-click a date label and group by month in Excel; in Sheets, use the pivot's date grouping option where available.
The refresh button does nothing. Check that Calculation is set to Automatic for the workbook, and that you are not refreshing a pivot whose source sheet is filtered - filters do not change pivot results unless you are using a slicer or filter field.
If that did not work, rebuild the source as a fresh flat table: one header row, one row per record, no merging, no subtotals, then insert a new pivot. Rebuilding usually takes less time than debugging a badly shaped range.
Frequently Asked Questions
Do I need to sort the source data first?
No. A pivot table groups and sorts for you, so sorting the raw data is unnecessary and can make it harder to spot duplicates. Sort the pivot output instead.
Can a pivot table have two fields in the Rows area?
Yes. Dragging a second field below the first creates nested groups - for example Region, then City inside it. Keep nesting shallow; two levels read well, four rarely do.
Why does my pivot show (blank) in a row label?
Some records have an empty cell in that column. Either fill the gaps in the source, or drag the field into Filters and untick the blank entry if it is genuinely irrelevant.
Should I use a pivot table or SUMIFS formulas?
Use a pivot when you are exploring and want to restructure quickly. Use formulas such as SUMIFS when you need a fixed dashboard that recalculates automatically without a refresh step and can be shared with people who will edit it.
Does a pivot table change my original data?
No. It reads the source and writes results elsewhere. Deleting or editing source cells only affects the result after a refresh, and never the other way round.
Can I share a pivot table with someone without the same software?
Copy or export it as values into a new file first, or save as PDF. Pivot tables are tied to the program that made them, so recipients using a different suite usually see static values at best.