How to Fix a PivotTable Calculated Field Returning #DIV/0! Error
Question details
The user needs to resolve a #DIV/0! error that appears when dividing Custom Widgets by Total Widgets using a calculated field in a PivotTable.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Calculating widget percentage totals categorized by month and location using a PivotTable calculated field.
- Observed behavior
- The calculated field returns a #DIV/0! error, likely due to zero or missing denominator values in the dataset or limitations inherent to traditional calculated fields.
Before modifying your PivotTable settings, briefly inspect your raw source data to identify if there are any blank cells or zeroes in the 'Total Widgets' denominator column.
Use Power Pivot and DAX Measures
Bypass traditional calculated field limitations by using Power Query and Power Pivot to handle zero denominators reliably without complex worksheet formulas.
Traditional calculated fields sum the data before performing the calculation, which can sometimes lead to unexpected zero values in the denominator. Using a Data Model and DAX (Data Analysis Expressions) provides a cleaner, more robust way to calculate percentages.
Select your source data, go to the 'Power Pivot' tab, and click 'Add to Data Model' to load your table.
In the Power Pivot window, select 'New Measure' and use the DIVIDE function, which safely handles zero denominators by default. For example: =DIVIDE(SUM([Custom Widgets]), SUM([Total Widgets]), 0).
Click 'PivotTable' from the Power Pivot window to insert a new table into your worksheet, then add your newly created measure to the Values area.
Add slicers for 'Month' and 'Location' via the 'PivotTable Analyze' tab to dynamically view your percentages without triggering any division errors.

Modify the Calculated Field with an IF Statement
Update your existing Calculated Field formula to manually check for zero values before performing the division.
Fix PivotTable Errors Seamlessly with WPS Spreadsheet
WPS Spreadsheet offers an intuitive interface for creating and managing PivotTables. You can easily modify calculated fields, apply error-handling formulas, and analyze your data without the hassle of #DIV/0! errors.
- 1. Open Your Data: Launch WPS Spreadsheet and open the workbook containing your raw data.
- 2. Create a PivotTable: Highlight your dataset, go to the 'Insert' tab, and click 'PivotTable' to generate your report.
- 3. Insert Calculated Field: Navigate to the 'Options' tab under PivotTable Tools, select 'Calculated Field', and name your new field.
- 4. Apply Safe Division: In the formula box, use an IF statement like =IF(Total=0,0,Custom/Total) to ensure blank or zero denominators do not cause a #DIV/0! error.

Frequently Asked Questions
Why does my PivotTable show a #DIV/0! error?
This error occurs when a formula in your Calculated Field attempts to divide a number by zero or by an empty cell. In PivotTables, if the sum of the denominator's data items equals zero for a specific row or column, it triggers this division error.
Can I simply hide the #DIV/0! errors without changing my formulas?
Yes. Right-click anywhere in your PivotTable and select 'PivotTable Options'. Under the 'Layout & Format' tab, check the box for 'For error values show:' and leave the adjacent text box blank (or type a zero). This will mask all formula errors in the table.
How are Calculated Fields different from regular formulas?
Calculated Fields perform their mathematical operations on the aggregated sum of the underlying data rather than calculating row-by-row. This means ratios and averages can sometimes yield different results than if you calculated them in the raw data beforehand.




