Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
When you create a pivot table based on existing data, you may find that the data in it is not exactly what you need. The desired data may be a combination of the original data. For example, you might need to add, subtract, multiply, or divide the original data before using it. At this point, you need to create a calculated field and set the appropriate formula for calculation. Then you can perform statistical and other operations on the calculated field.
Insert a calculated field in a PivotTable in Excel, follow these steps:


Please see the following sample code. The code first sets the original data and creates a pivot table. Then it creates the calculated field based on the existing PivotField in the pivot table and adds the calculated field to the data area. Finally, it saves the workbook in output XLSX format. After executing the example code, a pivot table with a calculated field is added to the worksheet.
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.