The Wayback Machine - https://web.archive.org/web/20241202020349/https://www.geeksforgeeks.org/excel-pivot-table-calculated-field/
Open In App

How to Create Excel Pivot Table Calculated Field with Examples

Last Updated: 06 Dec, 2023
Summarize
Comments
Improve
Suggest changes
Like Article
Like
Save
Share
Report
News Follow

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

data set

How to Create a Pivot Table in Excel

Follow 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).

Creating a Pivot Table

Img 1

PibotTable from table or range dialogue box

 

Step 2: Enter your data set range in “Table/Range” input, choose New worksheet, and Click “OK

Creating a Pivot Table

Step 3: Above step, add a new sheet with a pivot table for your data set.

Pivot Table

Pivot Table

Step 4: Drag the field “Products” to the Rows pane

Creating a Pivot Table

Step 5: Drag 2019_Sales and 2020_Sales to Values pane.

Pivot Table fields

How to Add Calculated Field

You created a pivot table for your dataset.  Now we add a calculated field to display the sales_differences in the pivot table

Step 6. To pop up the “Insert Calculated Field” dialogue box.  Click anywhere in the pivot table. Goto PivotTable Analyze in Ribbon >> Fields, Items & Sets >> Calculated Field…

Adding Calculated Field

Step 7. Above step pop-up below dialogue box and type “Sales_Differences” [Calculated field Name] in the Name input box

Insert Calculated Field dialogue box

Step 8. Select “2020_Sales” from the fields list and Click Insert Field.

Insert Field dialogue box

Step 9. Just type “-“ in Formula (for Subtraction).

Step 10. Select “2019_Sales” from the fields list and Click Insert Field.

Insert Calculated Field dialogue box

Step 11. Please make sure your formula is like below

='2020_Sales'-'2019_Sales'  

Step 12: Finally click Add then OK, you can see the pivot with additional columns “Sales_Differences” [Calculated Field] as in the below output

Adding Calculated field

Output

Output

About Calculated Fields

  • For calculated fields, the sum of the individual values in the other value fields is used before doing the computation on the sum.
  • All pivot tables based on the same pivot cache have calculated fields exposed by default.

What are Limitations of Calculated Fields

  • Calculated field formulas cannot use the address or name of worksheet cells
  • The pivot table totals or subtotals cannot be referenced in calculated field calculations

How to Modify or Delete a Pivot Table Calculated Field?

Following the procedures below, you can change or remove the formula in a Pivot Table Calculated Field:

Step 1. Select any cell in the Pivot Table

Step 2.  Select Fields, Items, and Sets under Calculations from the Pivot Table Tools → Analyze 

Analyze Tab

Analyze Tab

Step 3. Select Calculated Field

Step 4. Click on the drop-down arrow, In the Name field to select the calculated field you want to delete or modify

Insert Calculated Field dialogue box

Insert Calculated Field

Modify or Delete Calculated Field

Modify or Delete Calculated Field

FAQs on Excel Pivot Table Calculated Field

1. What is the difference between calculated item and calculated field?

  • Calculated Fields are formulas that can refer to other fields in the pivot table.
  • Calculated Items are formulas that can make references to other items inside a certain pivot field.
     


News
Improve
Discuss

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 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 Calculated Columns in Power Pivot in Excel: A Complete Guide

article_img
Power Pivot in Excel is a powerful data modelling tool that enables advanced calculations on large datasets. One of its standout features is calculated columns, which allow users to derive new data by applying custom formulas to existing columns. In this article, we’ll cover what calculated columns are, how to create them in Power Pivot, and their advantages and limitations. Table of ContentWhat are Calculated Columns in ExcelCreate Calculated Columns in Power Pivot in ExcelHow to Create Calculated Columns in Power Pivot in Excel ExamplesAdvantages of Calculated Columns in Power PivotLimitations of Calculated Columns in Power PivotUnderstanding Calculated Columns in Excel Power PivotCalculated columns are dynamic columns in Power Pivot that allow users to create new data by applying formulas or expressions to existing data. Unlike calculated fields, which are computed on-the-fly based on the context, calculated columns compute their values during data refresh. This makes them suitable for pre-computed data scenarios, such as sorting, filtering, complex calculations, or creating hierarchies. How to Create Calculated Columns in Power Pivot in ExcelFollow these steps to create calcula
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 add a calculated field in Google Form

article_img
Google Forms is a versatile tool widely used for data collection, but it traditionally lacks direct support for calculated fields. Understanding how to add a calculated field to your Google Form can significantly enhance its functionality, allowing you to perform real-time calculations based on user inputs. Here, we will provide a step-by-step guide on how to integrate calculated fields into your forms, a must-have skill for educators, event organizers, and business professionals who rely on dynamic data collection. How to Install Form Facade Add-onStep 1: Launch Google FormsStep 2: Open a New FormClick on the "+" icon to start a new form or select an existing form that you want to edit. Step 3: Click on three dots and Select Get Add-OnsClick on three dots (more options) and then go to "Get add-ons". Step 4: Search Formfacade and Click on InstallSearch for Formfacade add-on and then click on the Log in "Install" button. Log in and allow access, it will be installed successfully. How to Open Form Facade in Google FormStep 1: Click on the Add-On Icon and Select FormfacadeOpen Formfacade by clicking on the add-on icon and then click on Formfacade. Step 2: Go to Customize this form and
Read More

I

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

I

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 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
three90RightbarBannerImg