Applies ToExcel for Microsoft 365 Excel for Microsoft 365 for Mac Excel for the web Excel 2024 Excel 2024 for Mac Excel 2021 Excel 2021 for Mac Excel 2019 Excel 2016 Office for business Microsoft Office

A PivotTable is a powerful tool to calculate, summarize, and analyze data that lets you see comparisons, patterns, and trends in your data. PivotTables work a little bit differently depending on what platform you are using to run Excel.

If you have the right license requirements, you can ask Copilot to help you create a PivotTable.

Your browser does not support video. Install Microsoft Silverlight, Adobe Flash Player, or Internet Explorer 9.

  1. Select the cells you want to create a PivotTable from.

    Note:  Your data should be organized in columns with a single header row. See the Data format tips and tricks section for more details.

  2. Select Insert > PivotTable.

    PivotTable Button

  3. This creates a PivotTable based on an existing table or range.PivotTable from Range or Table

    Note: Selecting Add this data to the Data Model adds the table or range being used for this PivotTable into the workbook's Data Model. Learn more.

  4. Choose where you want the PivotTable report to be placed. Select New Worksheet to place the PivotTable in a new worksheet or Existing Worksheet and select where you want the new PivotTable to appear.

  5. Select OK.

By clicking the down arrow on the button, you can select from other possible sources for your PivotTable. In addition to using an existing table or range, there are three other sources you can select from to populate your PivotTable.Select PivotTable Source

Note: Depending on your organization's IT settings you might see your organization's name included in the list. For example, "From Power BI (Microsoft)."

Get from External Data Source

PivotTable from External Source

Get from Data Model

Use this option if your workbook contains a Data Model, and you want to create a PivotTable from multiple tables, enhance the PivotTable with custom measures, or are working with very large datasets. PivotTable from Data Table

Get from Power BI

Use this option if your organization uses Power BI and you want to discover and connect to endorsed cloud datasets you have access to.

PivotTable from Power BI

  1. To add a field to your PivotTable, select the field name checkbox in the PivotTables Fields pane.

    Note: Selected fields are added to their default areas: non-numeric fields are added to Rows, date and time hierarchies are added to Columns, and numeric fields are added to Values.

    Pivot Table

  2. To move a field from one area to another, drag the field to the target area.

If you add new data to your PivotTable data source, any PivotTables that were built on that data source need to be refreshed. To refresh just one PivotTable, you can right-click anywhere in the PivotTable range, and then select Refresh. If you have multiple PivotTables, first select any cell in any PivotTable, then on the ribbon go to PivotTable Analyze > select the arrow under the Refresh button, and then select Refresh All.

Refresh a PivotTable

Summarize Values By

By default, PivotTable fields placed in the Values area are displayed as a SUM. If Excel interprets your data as text, the data is displayed as a COUNT. This is why it's so important to make sure you don't mix data types for value fields. You can change the default calculation by first selecting the arrow to the right of the field name, and then select the Value Field Settings option.

Excel Value Field Settings dialog

Next, change the calculation in the Summarize Values By section. Note that when you change the calculation method, Excel automatically appends it in the Custom Name section, like "Sum of FieldName", but you can change it. If you select Number Format, you can change the number format for the entire field.

Tip: Since changing the calculation in the Summarize Values By section changes the PivotTable field name, it's best not to rename your PivotTable fields until you're finished setting up your PivotTable. One trick is to use Find & Replace (Ctrl+H) >Find what > "Sum of", and then Replace with > leave blank to replace everything at once instead of manually retyping.

Excel Value Field Settings dialog for Summarize Values By options

Show Values As

Instead of using a calculation to summarize the data, you can also display it as a percentage of a field. In the following example, we changed our household expense amounts to display as a % of Grand Total instead of the sum of the values.

PivotTable example with Values displayed as a percentage of the Grand Total PivotTable example with Values displayed as a percentage of the Grand Total

Once you've opened the Value Field Setting dialog box, you can make your selections from the Show Values As tab.

Display a value as both a calculation and percentage.

Simply drag the item into the Values section twice, and then set the Summarize Values By and Show Values As options for each one.

Data format tips and tricks

  • Use clean, tabular data for best results.

  • Organize your data in columns, not rows.

  • Make sure all columns have headers, with a single row of unique, non-blank labels for each column. Avoid double rows of headers or merged cells.Excel column 2

  • Format your data as an Excel table (select anywhere in your data, and then select Insert > Table from the ribbon).

  • If you have complicated or nested data, use Power Query to transform it (for example, to unpivot your data) so it's organized in columns with a single header row.

Need more help?

You can always ask an expert in the Excel Tech Community or get support in Communities.

PivotTable Recommendations are a part of the connected experience in Microsoft 365, and analyzes your data with artificial intelligence services. If you choose to opt out of the connected experience in Microsoft 365, your data will not be sent to the artificial intelligence service, and you will not be able to use PivotTable Recommendations. Read the Microsoft privacy statement for more details.

Related articles

Create a PivotChart

Use slicers to filter PivotTable data

Create a PivotTable timeline to filter dates

Create a PivotTable with the Data Model to analyze data in multiple tables

Create a PivotTable connected to Power BI Datasets

Use the Field List to arrange fields in a PivotTable

Change the source data for a PivotTable

Calculate values in a PivotTable

Delete a PivotTable

Need more help?

Want more options?

Explore subscription benefits, browse training courses, learn how to secure your device, and more.