How to Prevent DIV/0 Errors for Percentage Calculations in Excel & WPS
Question details
The user needs a formula to calculate percentage changes that avoids #DIV/0! errors when the denominator is zero, specifically desiring to return 0% or -100% based on the numerator's value.

- Product
- Spreadsheet
- Device & OS
- not provided
- Scenario
- Calculating percentage differences where the reference value (denominator) might be zero, causing standard division formulas to fail.
- Observed behavior
- The standard formula =(B1-A1)/B1 returns a #DIV/0! error when cell B1 is zero.
Verify which of your columns represents the original value and which represents the new value to ensure your formula references the correct denominator.
Use Nested IF Functions to Handle Zero Denominators
Explicitly handle zero values using the IF function to return custom percentage results like 0% or -100% without triggering an error.
This method allows you to define specific outcomes when the denominator is zero. In this scenario, it returns 0% when both the original and new values are zero, and -100% when the original value is positive but the new value drops to zero.
Click on the cell where you want the final percentage calculation result to appear.
Type the formula =IF(B1=0,IF(A1=0,0,-1),(B1-A1)/B1) into the formula bar. Ensure you adjust A1 (original value) and B1 (new value) to match your specific dataset.
Press Enter to apply the formula. Then, go to the Home tab and click the '%' icon (Percentage Style) to format the resulting decimal number as a percentage.

Use the IFERROR Function for a Simple Zero Fallback
If you simply want all #DIV/0! errors to display as 0% regardless of the numerator, use the IFERROR function.
Calculate Percentages Flawlessly with WPS Spreadsheet
WPS Spreadsheet provides full support for advanced logical functions like IF and IFERROR, allowing you to easily handle #DIV/0! errors. It is highly compatible with Microsoft Excel formulas, making complex data analysis smooth and hassle-free.
- 1. Open your dataset: Launch WPS Spreadsheet and open the document containing the data you want to analyze.
- 2. Input the error-handling formula: Select the target cell and enter your preferred nested IF or IFERROR formula into the formula bar.
- 3. Apply percentage formatting: Navigate to the Home tab and select the Percentage format from the Number formatting dropdown to display the result correctly.

Frequently Asked Questions
Why do I get a #DIV/0! error in my spreadsheet?
This error occurs when a formula attempts to divide a number by zero or by an empty cell. In percentage change calculations, this happens if the denominator (usually the base or new value) is zero.
Can I hide the #DIV/0! error completely instead of showing 0%?
Yes. You can instruct the formula to return a blank cell by modifying the IFERROR function to =IFERROR((B1-A1)/B1, ""). This will leave the cell empty if an error occurs.
How do I apply this formula to an entire column quickly?
After entering the formula in the first cell, hover over the bottom-right corner of that cell until your cursor turns into a cross icon. Double-click or drag it down to autofill the formula for the rest of the column.




