Menu
×
   ❮   
HTML CSS JAVASCRIPT SQL PYTHON JAVA PHP C C++ C# AWS W3.CSS HOW TO BOOTSTRAP REACT MYSQL JQUERY EXCEL XML DJANGO NUMPY PANDAS NODEJS DSA TYPESCRIPT ANGULAR ANGULARJS GIT POSTGRESQL MONGODB ASP AI R GO KOTLIN SWIFT SASS VUE GEN AI SCIPY CYBERSECURITY DATA SCIENCE INTRO TO PROGRAMMING HTML & CSS BASH RUST TOOLS

Excel Tutorial

Excel HOME Excel Introduction Excel Get Started Excel Overview Excel Syntax Excel Ranges Excel Fill Excel Move Cells Excel Add Cells Excel Delete Cells Excel Undo Redo Excel Formulas Excel Relative Reference Excel Absolute Reference Excel Arithmetic Operators Excel Parentheses Excel Functions

Excel Formatting

Excel Formatting Excel Format Painter Excel Format Colors Excel Format Fonts Excel Format Borders Excel Format Numbers Excel Format Grids Excel Format Settings

Excel Data Analysis

Excel Sort Excel Filter Excel Tables Excel Conditional Format Excel Highlight Cell Rules Excel Top Bottom Rules Excel Data Bars Excel Color Scales Excel Icon Sets Excel Manage Rules (CF) Excel Charts

Excel PivotTables

Excel PivotTable Intro Excel Create PivotTable Excel PivotTable Values Excel PivotTable Filter Excel PivotTable Group Excel Calculated Field Excel PivotChart

Excel Case

Case: Poke Mart Case: Poke Mart, Styling

Excel Functions

AND AVERAGE AVERAGEIF AVERAGEIFS CONCAT COUNT COUNTA COUNTBLANK COUNTIF COUNTIFS DATEDIF FILTER HLOOKUP IF IFERROR IFS INDEX INDEX MATCH LEFT LEN LOWER MATCH MAX MEDIAN MID MIN MODE NETWORKDAYS NPV OR PROPER RAND RIGHT ROUND SORT STDEV.P STDEV.S SUBSTITUTE SUM SUMIF SUMIFS SUMPRODUCT TEXTJOIN TODAY TRIM UNIQUE UPPER VLOOKUP XLOOKUP XOR

Excel How To

Convert Time to Seconds Difference Between Times NPV (Net Present Value) Remove Duplicates

Excel Cert

Excel Certificate

Excel Examples

Excel Exercises Excel Syllabus Excel Study Plan Excel Training

Excel References

Excel Keyboard Shortcuts


Excel Create a PivotTable


Share

Create a PivotTable

A PivotTable summarizes a large table in a few clicks.

You do not write any formulas. You pick the fields you want to see, and Excel does the math.

In this chapter, you will turn 2,740 rows of Poke Mart sales into a short summary of sales by category.

This chapter uses Poke Mart sales data. Download it to follow along: poke_mart_sales.xlsx

New to PivotTables? Read the PivotTable Introduction first.

The Example Data

The file has one sheet, Sales, with one row for each order.

The data is in the range A1:J2741: one header row and 2,740 orders from 2024 and 2025.

Here are the first rows:

ABCDEFGHIJ
1OrderIDDateStoreRegionProductCategoryQuantityUnitPriceSalesCost
210012024-01-01Lilycove CityHoennHyper PotionMedicine112001200680
310022024-01-01Cerulean CityKantoPoke BallBalls1920038002090
410032024-01-02Lilycove CityHoennGreat BallBalls1360078004290
510042024-01-02Cerulean CityKantoAntidoteStatus Healers9100900405
610052024-01-03Violet CityJohtoPotionMedicine1930057002850

The columns are:

ColumnDescription
OrderIDA unique number for each order, from 1001 to 3740
DateThe order date, from 2024-01-01 to 2025-12-31
StoreThe Poke Mart store that made the sale. There are 6 stores
RegionThe region of the store: Kanto, Johto or Hoenn
ProductThe item that was sold, for example Poke Ball or Potion. There are 10 products
CategoryThe product group: Balls, Medicine or Status Healers
QuantityHow many items the order had
UnitPriceThe price of one item
SalesThe order total: Quantity * UnitPrice
CostWhat the items cost the Poke Mart


Prepare the Data

A PivotTable needs data in a simple table shape:

  • One header row, with a unique name at the top of each column
  • No blank rows or blank columns inside the data
  • One kind of data in each column, for example only dates in the Date column
  • No merged cells, and no subtotal rows mixed in with the data

The Poke Mart data already follows these rules.

Tip: Format the Data as a Table

This step is optional, but it helps later.

Click any cell in the data and press Ctrl+T, then click OK. You can read more in Excel Tables.

A table grows by itself when you add new rows below it.

A PivotTable that uses a table picks up the new rows the next time you refresh it.

A PivotTable that uses a fixed range, like A1:J2741, does not. You would have to change the range yourself with PivotTable Analyze > Change Data Source.


Insert a PivotTable

Follow these steps:

  1. Click any cell in the data, for example A1
  2. Click the Insert tab
  3. Click the PivotTable arrow, then From Table/Range

The Insert tab in Excel with the PivotTable menu open and From Table/Range highlighted

The PivotTable from table or range dialog opens.

  1. Check the Table/Range box. Excel fills in the whole data range for you: Sales!$A$1:$J$2741. If you made a table, it shows the table name instead, like Table1
  2. Choose New Worksheet
  3. Click OK

The PivotTable from table or range dialog with the range Sales!$A$1:$J$2741 and New Worksheet selected

Excel adds a new sheet with an empty PivotTable. The PivotTable Fields pane opens on the right.

Note: In older versions of Excel, this dialog is called Create PivotTable. It works the same way.


The PivotTable Fields Pane

The top of the pane lists every column header from your data. In a PivotTable, the columns are called fields.

The bottom of the pane has four areas:

  • Filters: filter the whole PivotTable by a field
  • Columns: show each value of a field as a column
  • Rows: show each value of a field as a row
  • Values: the numbers to calculate, such as a sum or a count

Drag a field from the list down to an area to use it.

You can also check the box next to a field. Excel then puts text fields in Rows and number fields in Values.

To remove a field, uncheck its box, or drag it out of the area.

Note: The pane only shows when a cell inside the PivotTable is selected. If it stays hidden, click PivotTable Analyze > Field List.


Your First PivotTable

Let's find the sales for each product category.

  1. Drag Category to the Rows area
  2. Drag Sales to the Values area

The PivotTable Fields pane with Category in the Rows area and Sum of Sales in the Values area

The PivotTable now looks like this:

AB
1
2
3Row LabelsSum of Sales
4Balls4447200
5Medicine4413600
6Status Healers556000
7Grand Total9416800

Excel adds up the Sales for each category. It calls the result Sum of Sales.

The Grand Total is the sum of all 2,740 orders: 9,416,800.

Excel places a new PivotTable in cell A3. Rows 1 and 2 stay free for the Filters area, which you will use in the Filter chapter.

The numbers have no thousands separator yet. You will format them in the Values chapter.

Good job! 2,740 rows of data became a summary of three lines.


Add a Field to Columns

Now split each category by region.

  1. Drag Region to the Columns area
ABCDE
1
2
3Sum of SalesColumn Labels
4Row LabelsHoennJohtoKantoGrand Total
5Balls1479400164760013202004447200
6Medicine1303300151630015940004413600
7Status Healers189300199750166950556000
8Grand Total2972000336365030811509416800

Each cell shows the sales of one category in one region. For example, Medicine sold 1,594,000 in Kanto (cell D6).

The Grand Total column on the right adds up each row. The Grand Total row at the bottom adds up each column.

Try dragging Region from Columns to Rows. The numbers stay the same, but the layout changes.

Moving fields between areas to look at the data from a new angle is called pivoting.


Refresh a PivotTable

A PivotTable does not update on its own when the source data changes.

After you change the data, refresh the PivotTable:

  1. Click any cell in the PivotTable
  2. Click the PivotTable Analyze tab
  3. Click Refresh

You can also right-click the PivotTable and choose Refresh.

Note: The PivotTable Analyze tab only appears when a cell in the PivotTable is selected. In older versions of Excel, the tab is called Analyze or Options.

If you add new rows below a fixed range, Refresh does not include them. That is why a table is the better source (see the tip above).


Recommended PivotTables

Not sure where to start? Click Insert > Recommended PivotTables, and Excel suggests ready-made PivotTables for your data that you can pick and then change.


Free account

Track your progress

XP earned 0 Day streak 0 Spaces 0 League —

New

Learn in Adventure Mode W3Schools Adventure App

Coding fundamentals as bite-sized lessons and challenges.

×

Contact Sales

If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail:
sales@w3schools.com

Report Error

If you want to report an error, or if you want to make a suggestion, send us an e-mail:
help@w3schools.com

W3Schools is optimized for learning and training. Examples might be simplified to improve reading and learning. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. While using W3Schools, you agree to have read and accepted our terms of use, cookies and privacy policy.

Copyright 1999-2026 by Refsnes Data. All Rights Reserved. W3Schools is Powered by W3.CSS.