How to Prevent #DIV/0! Errors When Excel Cells Are Blank
Question details
The user wants to prevent #DIV/0! and #VALUE! errors in division formulas when referenced input cells are blank or contain zero, preferring the formula to return a blank or a custom text like 'NA'.

- Product
- Excel / WPS Spreadsheet
- Device & OS
- not provided
- Scenario
- Setting up comparison and division formulas where input data might not be filled in yet, causing unsightly error messages across the sheet.
- Observed behavior
- Excel returns a #DIV/0! error when dividing by zero or a blank cell, and a #VALUE! error in certain comparisons involving empty cells instead of leaving the cell empty.
Identify which cells in your formula act as denominators, as these are the exact cells that trigger the #DIV/0! error when left blank or filled with a zero.
Use the IFERROR Function to Return Blank Cells
Wrap your existing formula in the IFERROR function to automatically output a blank space (or any text you specify) whenever a calculation fails.
The IFERROR function checks if the primary formula results in an error. If it does, it outputs an alternative value that you define, rather than displaying standard error codes like #DIV/0! or #VALUE!.
Click on the cell containing the formula that is returning the #DIV/0! error.
In the formula bar at the top, type 'IFERROR(' immediately after the equals sign.
Go to the end of your existing formula, type a comma followed by two double quotes (,""), and close the parenthesis. For example: =IFERROR(your_formula, ""). Press Enter to apply.

Use the IF and OR Functions to Check for Empty Cells First
Test the input cells before performing the calculation so the division formula only runs if the cells contain valid data.
Handle Complex Excel Formulas Easily with WPS Spreadsheet
WPS Spreadsheet is a powerful, free tool that fully supports standard functions like IFERROR, IF, and OR. It provides an intuitive interface to help you quickly diagnose and fix calculation errors in your worksheets.
- 1. Open your workbook: Launch WPS Spreadsheet and open the document containing the formula errors.
- 2. Use the Insert Function tool: Navigate to the Formulas tab on the top ribbon and click 'Insert Function' (fx).
- 3. Search for IFERROR: Type 'IFERROR' into the search box to bring up a helpful dialog box that guides you through wrapping your division formulas step-by-step.

Frequently Asked Questions
Why does a blank cell cause a #DIV/0! error in spreadsheets?
In spreadsheet logic, empty cells are mathematically evaluated as zero. Since dividing any number by zero is a mathematical impossibility, the software returns the #DIV/0! error to let you know the operation cannot be completed.
What is the difference between IFERROR and IFNA?
IFERROR catches all standard error types, including #DIV/0!, #VALUE!, #NAME?, and #REF!. IFNA, on the other hand, specifically only handles the #N/A error, which usually results from failed lookup formulas like VLOOKUP.
Can I display a custom message instead of a blank space when an error occurs?
Yes. In the IFERROR function =IFERROR(A1/B1, ""), simply replace the empty space between the quotation marks with your desired text. For example, =IFERROR(A1/B1, "Awaiting Data") or =IFERROR(A1/B1, "NA").




