The Wayback Machine - https://web.archive.org/web/20241008132004/https://www.geeksforgeeks.org/pivot-tables-in-excel/
Open In App

How to Create a Pivot Table in Excel

Last Updated: 01 Oct, 2024

R

Summarize
Comments
Improve
Suggest changes
Like Article
Like
Save
Share
Report
News Follow

A PivotTable is a helpful tool in Excel that lets you calculate, summarize, and analyze your data. It helps you see comparisons, patterns, and trends. How PivotTables work can vary slightly depending on the version of Excel you are using.

Creating a Pivot Table in Excel can transform the way you analyze and summarize data. If you’re dealing with large datasets, Pivot Tables provide a dynamic and powerful tool to effortlessly organize and extract meaningful insights. Whether you’re managing sales figures, tracking project timelines, or analyzing survey responses, Pivot Tables help you make data-driven decisions quickly.

In this article, we’ll explore the process of creating a Pivot Table in Excel, ensuring you maximize your efficiency and productivity. Additionally, we’ll touch on how to create a Pivot Table in Google Spreadsheet, offering a comprehensive understanding of this tool across different platforms. Let’s start learning how to create a Pivot Table in Excel, and how to make a Pivot Table in Google Spreadsheet to streamline your data analysis and reporting tasks.

how-to-create-a-pivot-table-in-excel-(1)

How to Create a Pivot Table in Excel

What is Pivot Table in Excel

A Pivot table is a summary of your data package. The word ‘Pivot‘ in the Pivot table means to rotate the data in Excel to view it from a different perspective. Creating a Pivot table doesn’t mean adding, subtracting, or changing the data, it simply means reorganizing it so you can easily work with useful information.

Data Format Tips:

  • Use clean, tabular data for the best report.
  • Better to organize your data in columns, instead of rows.
  • Ensure all columns have headers, with a single row of unique, non-blank labels for each column. Avoid double rows of headers or merged cells.
  • 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 is organized in columns with a single header row

Why Use a Pivot Table in Excel

Pivot tables enable efficient data analysis, allowing users to visualize numerical data, summarize details, and identify trends quickly. With Excel and pivot tables, you can:

  • Compare product sales totals
  • Combine and remove duplicates
  • Filter out irrelevant data
  • Calculate totals or percentages

How to Create a Pivot Table in Excel

Creating a pivot table in Excel is easy and provides immense value. Here’s a simple guide:

Step 1: Open MS Excel and Select the Data

Open your worksheet, then select the data range you wish to analyze. Ensure the data is organized with columns and headers.

Step 2: Go to the Insert tab

Go to the “Insert” tab and click on “PivotTable.” Excel will prompt you to choose where the pivot table will appear.

Step 3: In the Tables group, click on the Pivot table tool

 Create a Pivot Table in Excel

Create Pivot Table >> Ok

Step 5: Set Up Your Pivot Table

Excel will create an empty pivot sheet in Excel. Use the right-side panel to drag fields (column headers) into rows, columns, and values.

 Create a Pivot Table in Excel

Pivot Table Created

How to Build a Pivot Table Report

On the left side of the sheet, a new empty pivot table has been created where the summary would be shown. On the right side, we can see the FIELD NAME which are the headers of the columns of our data set. FIELD NAME is to be dragged to empty boxes i.e. Filters, Columns, Rows, and values to show their corresponding values in the Pivot Table.

Let’s drag the FIELD NAME into the boxes and see their effects individually. 

 Create a Pivot Table in Excel

Drag the Field Name

Step 1: Add Pivot Table Fields

Values sum up all the entries in the FIELD NAME dragged in it. Here, as Sales are dragged here, our pivot table shows the sum of all the sales that took place. 

 Create a Pivot Table in Excel

Drag the Fields between areas

Step 2: Sum of Sales Appeared

Scre Create a Pivot Table in Excelenshot20210515at11215PMmin

Sum of Sales Appeared

Step 3: Add More Fields

We can add as many FIELD names as we require in Values. Individual sums would be shown then.

 Create a Pivot Table in Excel

Add More Fields

Step 4: Drag to Get Sum

Dragging fields into values will give you the sum of values as a result.

 Create a Pivot Table in Excel

Sum Calculated

Step 5: Returned to Total Count

If the entities in the column can’t be summed, it will give us the total count of the entries present in that column.  Here as Country and Product do not contain numeric values, it returned the total count of each column.

 Create a Pivot Table in Excel

Total Count

Step 6: Drag Fields into Values

Dragging Fields into Values.

 Create a Pivot Table in Excel

Drag Fields into Values

Step 7: Count Not Found

In the below image, you can find the Count of the Values.

 Create a Pivot Table in Excel

Count Not Found

Step 8: Data Gets Grouped

The data in the pivot table gets grouped (Row-Wise) by the Field Names dragged to the Rows Area. 

In this example, we have grouped the sales by the countries. 

 Create a Pivot Table in Excel

Data Gets Grouped

Step 9: Fields dragged to Rows

In the below image, the fields are dragged to Rows.

 Create a Pivot Table in Excel

Fields dragged to Rows

We can drag as many Fields as we require in this region.

How to Create Pivot Table Columns Area in Excel

Creating Pivot Table using the Column Area in Excel

Step 1: Use Discount Band

The data in the pivot table gets grouped by(Column-Wise) by the Field Names dragged to Columns Area. As here, row-wise, our data is grouped by Countries and column-wise, it is grouped by Discount Band. 

 Create a Pivot Table in Excel

Use Discount band

Step 2: Fields Dragged to Columns

The Fields are dragged to Columns in the below image.

 Create a Pivot Table in Excel

Fields Dragged to Columns

This area can accommodate many Fields. 

Filter Area in Excel

The filter is an important feature in the pivot table. using which we can filter out the data based on the Field dragged into it.

Step 1: Filter the Total Sales

Here, we have filtered the total sales based on one particular product that is only that product is considered while calculating the sales. 

 Create a Pivot Table in Excel

Filter the Total Sales

Step 2: Apply Features

You can also apply many features to the Product fields as shown below.

 Create a Pivot Table in Excel

Apply features

Step 3: Final Output

Below is the final output of the above steps. In this way, using pivot tables, a summary of the data is achieved in the form of a matrix. There are many other tools and features of the Pivot Tables which can be explored. 

 Create a Pivot Table in Excel

Final Output

How to Delete a Pivot Table in Excel

Here are the steps to delete a Pivot Table:

Step 1: Select a Pivot Table

Select the Pivot Table which you need to be deleted.

 Create a Pivot Table in Excel

Select the Pivot Table

Step 2: Press the “Delete” key

 Create a Pivot Table in Excel

Click on Delete button

Step 3: Table Deleted

How to Sort a Pivot Table

Here are the steps to sort a Pivot Table:

Step 1: Select the column or row

Click and Select the Column row

 Create a Pivot Table in Excel

Select a Column or Row

Step 2: Sort in ascending or descending order

Choose the sorting (ascending or descending) order as per your need.

 Create a Pivot Table in Excel

Click on Sort button to Sort Pivot Table

Tips & Tricks For Excel Pivot Tables

  • Let Excel suggest Pivot Table layouts based on your data. Go to Insert > Recommended PivotTables.
  • Group dates by month, quarter, or year for better trend analysis.
  • Group items manually to create custom categories.
  • Add slicers for a visual and interactive way to filter your Pivot Table data.
  • Use multiple slicers for more granular control over your data views.
  • Add calculated fields to perform custom calculations within your Pivot Table without altering the source data.
  • Use complex formulas for sophisticated data analysis.

Conclusion

Mastering pivot tables in Excel will revolutionize your data analysis capabilities. With Excel pivot tables, you can quickly identify patterns, trends, and anomalies in your datasets. Whether you’re new to Excel and pivot tables or an experienced user, understanding how to create a pivot table in Excel is essential for efficient data analysis. Make the most of your data by utilizing this powerful feature across both Excel and Google Sheets.

Also Read

How to Create a Pivot Table in Excel – FAQs

How do I create a PivotTable in Excel?

Follow the the steps given below:

  • Select Your Data
  • Go to the Insert tab
  • Click on PivotTable
  • Create the PivotTable

How do I create a PivotTable with rows and columns?

To create Pivot Table with rows and columns follow the steps given below:

  • Select Your Data
  • Go to the Insert tab
  • Drag the rows
  • Drag the Columns

What is a PivotTable in Excel used for?

A PivotTable in Excel is used for:

  • Summarizing Data
  • Analyzing Data
  • Data Exploration
  • Creating Reports
  • Filtering Data

How do I create a pivot chart from Excel data?

Here are the steps to create a pivot table from the Excel data:

  • Go to the Insert tab
  • Click on PivotTable
  • Customize the PivotChart

What is Pivot Table in Excel Formula?

Here are some of the Pivot table formulas:

  • Sum: ‘=SUM(Sales)’
  • Average: ‘=AVERAGE(Sales)’
  • Count: ‘=COUNT(Quantity)’
  • Product: ‘=PRODUCT(Quantity)’


R

News
Improve
Discuss

How to Create Pivot Chart from Pivot Table in Excel using Java?

A Pivot Chart is used to analyze data of a table with very little effort (and no formulas) and it gives you the big picture of your raw data. It allows you to analyze data using various types of graphs and layouts. It is considered to be the best chart during a business presentation that involves huge data. To add a pivot chart to an Excel worksheet, you need to use the "WorksheetChartsCollection.add" method.  Before Creating a Pivot Chart, one first needs to go through how to Create Pivot Table in Excel using Java. Now let's discuss the steps to create a pivot chart in an Excel file in Java using Free Spire.XLS for Java API. How to Create a Pivot Table in Excel using JavaStep 1: Load the Excel fileWorkbook workbook = new Workbook() String workbookName = "Geeks_For_Geeks.xlsx"; workbook.loadFromFile(workbookName); Step 2: Get the first worksheetWorksheet sheet = workbook.getWorksheets().get(0); Step 3: Get the first pivot table in the worksheetIPivotTable pivotTable = sheet.getPivotTables().get(0); Step 4: Add a clustered column chart based on the pivot table to the second worksheetChart chart = workbook.getWorksheets().get(1).getCharts().add(ExcelChartType.ColumnClustered, pivotTa
Read More

How to Create Excel Pivot Table Calculated Field with Examples

article_img
You can add calculated fields to a pivot table using your own unique algorithms that add up to other pivot fields. A calculated field has some restrictions, but it gives the pivot tables in your Excel worksheet a strong tool. What is a Pivot Table Calculated Field in Excel“Pivot Table calculated field” is an option to include more data or calculations in the pivot table. Often, we need to add our own custom calculations that can refer to other fields in the data set for our reports.   In the below examples, we create a sales report by-product with an additional column "Sales Differences" [2020_Sales - 2019_Sales].  The calculated field "Sales Differences" calculation refers to other fields in the dataset [subtract 2019_Sales from 2020_Sales]. Example: We have a data set in four columns “Product”, ”Customer”, “2019_Sales” and “2020_Sales” as below How to Create a Pivot Table in ExcelFollow the below steps to create a pivot table Step 1: Select Insert >> Pivot >> From Table/Range (Img1)  to pop-up "Pivot Table from table or range" dialogue box (Img 2). Step 2: Enter your data set range in "Table/Range" input, choose New worksheet, and Click “OK Step 3: Above step, add a n
Read More

How to Create Pivot Table in Excel using Java?

A pivot table is needed to quickly analyze data of a table with very little effort (and no formulas) and sometimes not everyone has time to look at the data in the table and see what’s going on and use it to build good-looking reports for large data sets in an Excel worksheet. Let's discuss a step-by-step proper explanation to create a pivot table in an Excel file in Java using Free Spire.XLS for Java API. Requirements to Create Pivot Table in Excel using JavaFirstly, we need to add necessary dependencies to the Maven project including the Free Spire.XLS project before starting to write the code. How to Install Spire.XLS for JavaBy adding the following code to your project's pom.xml file, you can quickly import the JAR file into your program if you use Maven. C/C++ Code <repositories> <repository> <id>com.e-iceblue</id> <name>e-iceblue</name> <url>http://repo.e-iceblue.com/nexus/content/groups/public/</url> </repository> </repositories> <dependencies> <dependency> <groupId>javax.xml.bind</groupId> <artifactId>jaxb-api</artifactId> <version>2.3.1</version> </dependency>
Read More

How to Remove Pivot Table But Keep Data in Excel?

In this article, we will look into how to remove the Pivot Table but want to keep the data intact in Excel. To do so follow the below steps: Step 1: Select the Pivot table. To select the table, go to Analyze tabSelect the menu and choose the Entire Pivot Table. Step 2: Now copy the entire Pivot table data by Ctrl+C. Step 3: Select a cell in the worksheet where you want to paste the data. Step 4: Click Ctrl+V, to paste the data. Step 5: Click on the Ctrl dropdown. Choose the value(v) option from Paste options. Step 6: Now, again select the entire Pivot table. Step 7: Delete it using the Delete key on the keyboard. Step 8: Or you can also choose the Clear All command from the Home tab => Editing section => Clear dropdown. You will find your pivot table will be completely deleted from the worksheet. Thus, we can delete the pivot table without losing pivot table data.
Read More

How to Delete a Pivot Table in Excel?

article_img
A pivot table is a tool in Excel that allows you to quickly summarize data in the spreadsheet. When it comes to deleting a Pivot Table, there are a few different ways you can do this. The method you choose will depend on how you want to delete the Pivot Table. 1.Delete the Pivot Table and the Resulting Data. Steps to delete the Pivot table and the Resulting Data- Select any cell in the Pivot TableSelect the ‘Analyze’ tab. Click on the ‘Select’ option in the Actions group.Choose Entire Pivot tableHit the Delete key.2.Delete the Pivot Table but Keep the Resulting Data. If we want to delete the entire pivot table but retain the resulting data, the procedure is more or less the same Steps to delete the Pivot table but Keep the Resulting Data: Select any cell in the Pivot TableChoose the ‘Analyze’ tab in the ribbon. In the Actions group, choose the ‘Select’ option. Select the Entire Pivot table. Right-click on any cell of the selected Pivot Table.Click on Copy. This will copy the data of the entire Pivot Table. Click the Home tab. Click on the Paste option. In the Paste Values section, click on the first icon. The above steps would delete the Pivot Table but still keep the resulting dat
Read More

Refresh Pivot Table Data in Excel

In the Pivot data table, data can be grouped based on Dates, Numbers, and Text values. In the case of dates, we can group dates by months or year, months by years, etc. At any time, data for the PivotTables in your workbook can be refreshed using the Refresh button. You can also refresh data from a source table in the same or a different workbook. By default, PivotTables are not refreshed automatically when data in the source table is changed, but you can set your workbook to refresh its PivotTable data automatically when you open it. Steps to Manually refresh: Follow the below steps to manually refresh PiviotTable Data in Excel: Click on the PivotTable to show the PivotTable Tools on the ribbon. In PivotTable Tools, Click Analyze > Refresh, or press Alt+F5. Click the Refresh button on the Analyze tab (Click Analyze > Refresh All, to update all PivotTables in your workbook at once). If refreshing takes longer, click Analyze > Refresh arrow > Refresh Status to check the refresh status.To stop refreshing, click Cancel Refresh.Steps to prevent column width and cell formatting while refreshing: Follow the below steps to prevent column with and cell formatting while refreshi
Read More

How to Remove Old Row and Column Items from the Pivot Table in Excel?

article_img
Pivot table is one of the most efficient tools in excel for data analysis. If you are using pivot tables frequently, then you will find even after deleting the old data from the data source, it remains in the filter drop-down of the pivot table. We will learn, how to remove the old row and column items from the pivot table in excel. Reason for not removal of the old dataTo better understand, why the data is not removed in the pivot table, even after removing it from the source data, you need to understand the architecture of the pivot table. Internally, the pivot tables have a pivot cache, where the copy of the source data is held. This is done to faster the data retrieving process from the source to the pivot table. Whenever you refresh the pivot table, it gets updated from the pivot cache and not the source data. So, the pivot cache has its properties and default behavior. One of the default behavior, of pivot cache, is that it does not delete the old rows or columns from the filter drop-down. It is a default setting which can be changed very easily. Removing Old rows and columns from the Pivot table Given a table students and their marks. A pivot table is also made from the give
Read More

How to Add and Use an Excel Pivot Table Calculated Field?

article_img
Excel pivot tables are one of its most helpful features. They are utilized to summarize or aggregate large quantities of data. The data can be summarized using the average, the count, or other statistical approaches. It summarizes a large amount of data into a few rows and columns. They make it simple to explore the data from various views and angles and are excellent for data exploration. When you create a Pivot table, you often need to add more data and calculations to your analysis. If you require a new data point that can be obtained by leveraging existing data points in the Pivot Table, you don't need to go back and add it to the source data. Instead, you can utilize a Pivot Table Calculated Field to accomplish this. Pivot Table Calculated Field The "Pivot Table calculated field" option allows you to insert more data or calculations in the pivot table. For our reports, we frequently need to include our own unique calculations that can relate to other fields in the data collection. Benefits of using a Pivot Table Calculated FieldIt is scalable since it will automatically account for any new data added to your Pivot Table. You can utilize a Calculate Field in your Pivot Table ju
Read More

How to Troubleshoot and Fix Excel Pivot Table Errors?

article_img
Power Pivot is an Excel add-in, a data modeling technology that helps the user to create data models, establish relationships, and create calculations. However, it is possible to encounter a few errors during the process. here in this article, we will discuss some of the Excel Pivot Table Errors that may occur and how we can fix them. Usually, Excel Pivot works smoothly and efficiently, however, it is inevitable to encounter some errors while working with the software. Here are some of the common errors that users might encounter during working with Excel PowerPivot. "Unable to load the Data Model" Error Sometimes, A simple data change, for example, adding the pivot table data to the Data Model may cause a pivot table refresh error. It’s not that common, however, sometimes users do face such issues. As we can see in the image below: Here, in the image, as we can see above the message is showing that the “PowerPivot is unable to load the Data Model”. Solution: The change from the UPPER case to the PROPER case or other similar changes in the source data headings may be the primary cause of this error resulting in the data model having a second instance of the field. As shown in the i
Read More

How to Apply Conditional Formatting in a Pivot Table in Excel

article_img
One of the most useful ways to customize the pivot table formatting is using Conditional Formats. Conditional formatting rules can be applied to Pivot tables just like they can be applied to normal data ranges. So by using conditional formatting, we can highlight the cells with a certain color depending on the cell's value. Conditional FormattingWhat is Pivot Table Conditional Formatting In Excel, you have the power to make your data stand out using conditional formatting. This means you can automatically highlight cells that meet certain criteria. For example, you can easily spotlight cells that have values above the average or those that fall below a specific threshold. Now, when you apply this special formatting to a Pivot table, there is an important step to remember. After you've set up your conditional formatting, make sure to tweak the settings so that even after you refresh the Pivot table, the right cells maintain their distinctive appearance. This ensures that your highlighted information remains accurate and up-to-date as your data evolves. Types of Conditional Formatting in ExcelThere are many conditional formats that we can use on our data. Some of them are given below
Read More