What a pivot table does and when to use one
A pivot table is a tool that reorganizes raw data into a summary you can read at a glance. Instead of scrolling through thousands of rows, a pivot table groups data by the categories you choose and shows totals, counts, or averages for each group. If you have a spreadsheet of sales transactions and want to see total revenue by region or product, a pivot table does that in seconds.
Pivot tables work best when your data has a clear structure: column headers in the first row, and each row below representing one transaction, customer, or event. The larger your dataset, the more useful a pivot table becomes. A spreadsheet with 50 rows of data might not need one, but 5,000 rows almost certainly does.
Key Takeaways
- A pivot table summarizes large datasets by grouping rows into categories you choose and calculating totals, counts, or averages for each group.
- Your data must have headers in the first row and be organized so each row represents one record — no blank rows or merged cells in the middle of the data.
- In Excel, you select your data, go to Insert > Pivot Table, choose where to place it, and drag fields into Rows, Columns, and Values areas.
- In Google Sheets, you select your data, go to Insert > Pivot Table, and use the same drag-and-drop interface to organize your summary.
- Once created, you can filter, sort, and refresh a pivot table without rebuilding it from scratch.
Preparing your data for a pivot table
Before you create a pivot table, spend a minute checking that your data is clean. Open your spreadsheet and look at the first row — it should contain headers (like "Date", "Product", "Region", "Sales Amount"). Every row below should represent one complete record with no blank rows in between.
If your data has merged cells, extra spaces, or inconsistent formatting in a column (for example, "North" in one row and "north" in another), the pivot table will treat them as separate categories. Fix these before you start. You do not need to sort the data — the pivot table will do that for you.
Select all your data including the headers. In Excel, click the first cell with data, then press Ctrl+Shift+End (or Cmd+Shift+End on Mac) to select to the last cell with content. In Google Sheets, click the first cell and use the same keyboard shortcut, or manually drag to select the range.
Creating a pivot table in Excel
With your data selected, go to the Insert tab at the top of the ribbon. Click Pivot Table (in older versions of Excel, this may be under Data instead). A dialog box will appear asking where you want the pivot table to go. Choose New Worksheet to place it on a separate sheet, or Existing Worksheet if you want it on the same sheet as your data.
Click OK. Excel opens the Pivot Table Fields panel on the right side of the screen. You will see a list of all your column headers. Below that are four drop zones: Filters, Columns, Rows, and Values. Drag a field into Rows to group your data by that category. For example, drag "Region" into Rows to create one row for each region in your summary.
Drag another field into Columns if you want to break down your summary by a second dimension. For instance, drag "Product" into Columns to show each product as a separate column. Finally, drag a numeric field (like "Sales Amount") into Values. Excel will automatically sum it, but you can change this to average, count, or other calculations by double-clicking the field in the Values area.
Once you have set up your fields, the pivot table appears on the worksheet. You can now filter, sort, and adjust it without rebuilding it. If your source data changes, right-click the pivot table and select Refresh to update the summary.
Creating a pivot table in Google Sheets
With your data selected, go to the Insert menu and click Pivot Table. Google Sheets opens a new sheet and displays the Pivot Table Editor panel on the right. Like Excel, you will see your column headers listed and four areas to drag them into: Rows, Columns, Values, and Filters.
Drag a field into Rows to group your data by that category. Drag another field into Columns to create a second dimension of breakdown. Drag a numeric field into Values to calculate totals, averages, or counts. Google Sheets defaults to summing numeric fields, but you can click the field in the Values area and choose a different calculation from the dropdown menu.
Google Sheets updates your pivot table in real time as you drag fields around. If you need to add a filter — for example, to show only data from a specific region — drag a field into the Filters area. A dropdown will appear at the top of the pivot table where you can select which values to include.
Common calculations and how to change them
By default, pivot tables sum numeric fields. If you drag "Sales Amount" into Values, the pivot table shows the total for each group. But you might want a different calculation instead. In Excel, double-click the field name in the Values area. A dialog opens where you can choose Sum, Average, Count, Min, Max, or other options. Select what you need and click OK.
In Google Sheets, click the field name in the Values area and a menu appears. Click the dropdown next to the calculation type and choose from Sum, Average, Count, Count Unique, Min, Max, and others. The pivot table updates immediately. You can add the same field to Values multiple times with different calculations — for example, showing both the total and average for sales amounts.
Filtering and sorting a pivot table
Once your pivot table exists, you can narrow it down without rebuilding it. In both Excel and Google Sheets, small dropdown arrows appear in the row and column headers. Click a dropdown to filter that category — for example, click the dropdown next to "Region" to show only North and South, hiding East and West.
To sort a pivot table, click a dropdown arrow and choose Sort A to Z or Sort Z to A. You can also sort by the values in the summary — for example, sort regions by total sales from highest to lowest. In Excel, right-click a cell in the pivot table and select Sort to access more sorting options. In Google Sheets, click a cell and use the Data menu to sort.
Refreshing and updating a pivot table
If the data in your original spreadsheet changes, your pivot table does not update automatically. In Excel, right-click anywhere in the pivot table and select Refresh. You can also select the entire pivot table and go to Analyze > Refresh. In Google Sheets, the pivot table updates automatically when you change the source data, so no manual refresh is needed.
If you add new rows to your source data and want them included in the pivot table, you may need to expand the data range. In Excel, right-click the pivot table, select Pivot Table Options, and update the data range. In Google Sheets, click the pivot table, open the Pivot Table Editor, and update the data range at the top of the panel.
Frequently Asked Questions
Can I create a pivot table from data on multiple sheets?
No. A pivot table pulls from one continuous range on one sheet. If your data is split across sheets, copy it into a single sheet first. You can paste it all into one location, then create the pivot table from that combined data.
What if my pivot table shows "blank" or unexpected categories?
This usually means your source data has extra spaces, inconsistent capitalization, or typos. For example, "North" and "north" will appear as two separate categories. Go back to your original data, find and fix these inconsistencies, then refresh the pivot table.
Can I move or copy a pivot table?
In Excel, you can cut and paste a pivot table to a different location on the same sheet or a different sheet. In Google Sheets, pivot tables are tied to their sheet, so you cannot move them, but you can create a new pivot table from the same data on a different sheet. Both programs let you copy the pivot table as values and paste it elsewhere if you need a static snapshot.
How do I remove a field from a pivot table?
In Excel, drag the field name out of its area in the Pivot Table Fields panel, or right-click it and select Remove Field. In Google Sheets, click the X next to the field name in the Pivot Table Editor. The pivot table updates immediately.
What is the difference between putting a field in Rows versus Columns?
Fields in Rows create separate rows in your summary, one for each category. Fields in Columns create separate columns. If you put Region in Rows and Product in Columns, you get regions down the left side and products across the top, with totals in the cells where they meet.