Home Guides Excel

Excel

How to Create a PivotTable in Excel: Step-by-Step With a Real Example

Learn how to create a PivotTable in Excel, prepare source data, place fields, summarize values and avoid common reporting mistakes.

In this guide Step-by-step explanations, practical examples and useful context to help you complete the task confidently.

A PivotTable is useful when a worksheet has too many rows to summarize comfortably with manual totals. Instead of writing a separate formula for every category, you can group and summarize the same source data into a report that can be rearranged.

A good PivotTable starts with good source data. If the source has inconsistent headers, mixed data types or blank rows inside the dataset, the report can be harder to build and harder to trust.

What a PivotTable is good for

Use a PivotTable when you need to answer questions such as:

  • How much did each region sell?
  • Which products generated the most revenue?
  • How many orders were placed each month?
  • What is the average order value by salesperson?
  • How do results compare across categories and periods?

Microsoft describes PivotTables as a way to calculate, summarize and analyze data so you can see comparisons, patterns and trends.

Prepare the source data first

Your source should normally have a single header row, one record per row and consistent data types within each column.

DateRegionProductSales
Jan 5NorthLaptop$1,200
Jan 8SouthMonitor$900
Jan 14NorthMonitor$1,450
Feb 3NorthLaptop$800

Avoid merged cells and decorative subtotal rows inside the source range. Keep each column focused on one kind of information.

Step 1: select your data

Click a cell inside the dataset. If the data is already formatted as an Excel Table, the table can be used as the PivotTable source.

Step 2: insert the PivotTable

  1. Go to Insert > PivotTable.
  2. Check that Excel selected the correct table or range.
  3. Choose whether to place the PivotTable on a new worksheet or an existing worksheet.
  4. Select OK.

Excel creates a blank PivotTable and displays the field list.

Step 3: place fields in the report

For the sales example, a useful first report is sales by region:

PivotTable areaFieldPurpose
RowsRegionCreates one row for each region
ValuesSalesSummarizes the sales amount

Excel normally places text fields in Rows and numeric fields in Values, but you can move fields manually to build the report you need.

Build a more useful report

To compare sales by region and product, put Region in Rows, Product below it in Rows, and Sales in Values.

To see a time comparison, put a date field in Rows or Columns and use the grouping options available in your Excel version. Always verify that the source date column contains real dates rather than text.

Change how values are summarized

Excel may summarize numeric values with Sum, while text or blank-containing value fields may default to Count. You can change the summary method when the question requires it.

For example, Sum of Sales answers a revenue-total question. Average of Sales answers a different question: what is the average value of the records being summarized?

Example: sales by region

With the four-row sample above, a PivotTable that places Region in Rows and Sales in Values produces totals such as:

RegionTotal sales
North$3,450
South$900

The point of the PivotTable is not just the total. Once the fields are in place, you can rearrange the report to answer a different question without rewriting the underlying formulas.

Refresh the PivotTable when source data changes

A PivotTable is based on a snapshot of its source data. If the underlying records change or new rows are added, refresh the PivotTable so the report reflects the current source.

For recurring reports, using an Excel Table as the source can make expanding data easier to manage than a fixed cell range.

Common PivotTable mistakes

  • Mixed data types: Dates and numbers should not be mixed with arbitrary text in the same source column.
  • Blank or duplicate headers: Give every source column a clear header.
  • Wrong summary: Count and Sum answer different questions.
  • Stale report: Refresh after source data changes.
  • Bad source range: Check that all required rows and columns are included.
  • Reading a total without checking the filter: A filtered PivotTable may be showing only part of the source.

PivotTable vs formulas

A PivotTable is useful for exploration and reporting because fields can be rearranged quickly. Formulas such as SUMIFS and COUNTIFS can be better when you need a fixed dashboard layout or a result embedded directly in a worksheet.

You do not need to choose one approach for every workbook. Many useful spreadsheets use PivotTables for exploration and formulas for the final report.

Practical checklist

  • Give every source column a clear header.
  • Keep one record per row.
  • Keep data types consistent.
  • Insert the PivotTable from the correct range or table.
  • Put descriptive fields in Rows or Columns and measures in Values.
  • Confirm whether Sum, Count or Average answers the actual question.
  • Refresh the PivotTable after changing the source data.

For formula-based summaries, see SUMIF and SUMIFS and COUNTIF and COUNTIFS. For a broader collection of spreadsheet workflows, browse Excel Guides.

Quick answer

Select clean source data, choose Insert > PivotTable, place fields into Rows, Columns, Values and Filters, then check that the summary method answers the question you are trying to answer. Refresh the report whenever the source data changes.

You've reached the end

Use the related tools, FAQs and next guides below to continue from the topic you just learned.

Questions & answers

Frequently Asked Questions

What is a PivotTable used for?

A PivotTable summarizes and analyzes source data so you can compare totals, counts, averages, patterns and trends without building a separate formula for every category.

Why is my PivotTable showing the wrong total?

Check the source range, filters, field placement and summary method. Sum, Count and Average answer different questions, and a stale PivotTable may also need to be refreshed.

Should Excel source data have headers for a PivotTable?

Yes. A clean source normally has one header row, one record per row and consistent data types within each column.

Does a PivotTable update automatically when source data changes?

Not always. Refresh the PivotTable after the source changes. Using an Excel Table as the source can also make expanding datasets easier to manage.

Continue learning

Related Guides

Explore the next practical guide without leaving Tervilo.

Learn more

Related Articles

Understand the wider topic with an informative Tervilo article.