Excel Formula to Subtract Values When a Cell is Zero
Question details
The user needs an Excel formula that evaluates a cell's value; returning zero if the cell is zero, or subtracting it from another cell if it is not zero.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Setting up a dynamic spreadsheet where subtraction calculations are dependent on whether a specific target cell equals zero.
- Observed behavior
- The user wants a conditional formula to output exactly 0 when cell B11 is 0, and to perform the calculation B10 - B11 for any other numerical value.
Ensure that the cells you are referencing (e.g., B10 and B11) contain numerical values and are not formatted as text to prevent calculation errors.
Use the IF Function to Conditionally Subtract
The IF function is the most effective way to test if a cell is zero before executing a subtraction calculation.
The IF function in Excel evaluates a logical condition and returns one value if the condition is true, and another if it is false. By using this function, you can check if your target cell equals zero first, avoiding negative or unwanted calculation results.
Click on the cell where you want the final result to appear (for example, cell C11).
Type the following formula exactly into the formula bar at the top of the screen: =IF(B11=0,0,B10-B11)
Press Enter. The cell will now display 0 if B11 is 0, or it will display the mathematical result of B10 minus B11 if B11 contains any other number.

Easily Handle Conditional Formulas in WPS Spreadsheet
WPS Spreadsheet provides full, built-in support for advanced logical functions like IF, AND, and OR. You can effortlessly manage complex calculations and data analysis within a clean, intuitive interface.
- 1. Open Your Workbook in WPS Office: Launch WPS Office and open your document in the Spreadsheet module.
- 2. Input the Conditional Formula: Select the cell where you want the result, then type =IF(B11=0,0,B10-B11) and press Enter.
- 3. Use the Fill Handle: Click the small square at the bottom right corner of the selected cell and drag it down to apply the same conditional subtraction logic to multiple rows.

Frequently Asked Questions
How do I handle empty cells instead of zeroes in this formula?
To treat completely blank cells as zero, modify the formula using the OR function: =IF(OR(B11=0,ISBLANK(B11)),0,B10-B11). This ensures that if the cell is either fully blank or contains a zero, the output is 0.
Can I return a blank space instead of a zero when the condition is met?
Yes. To output a blank cell instead of the number 0, use empty double quotation marks for the 'value_if_true' argument. The formula will look like this: =IF(B11=0,"",B10-B11).
Why is my subtraction formula returning a #VALUE! error?
The #VALUE! error typically appears if one of the referenced cells contains text, hidden spaces, or special characters instead of numbers. Check both B10 and B11 to ensure they are strictly formatted as numbers.




