Return Zero for a Blank Cell or Unneeded Quantity in Excel
Question details
The user needs an Excel formula that returns zero when an input cell is blank or the required quantity has been met.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- Calculate an ordering quantity from the current quantity in C3 and the required quantity in D3.
- Observed behavior
- The desired result is zero when C3 is blank or at least D3; otherwise, the result should be D3 minus C3.
Check that C3 contains the current quantity or is blank, and that D3 contains the required quantity as a number. Choose an empty cell, such as E3, for the result.
Use IF and OR to Calculate the Remaining Quantity
Use this formula to return zero for a blank input or a quantity that already meets the requirement.
In Excel, click an empty cell such as E3, next to the quantities in C3 and D3.
Type =IF(OR(C3="",C3>=D3),0,D3-C3) and press Enter.
If needed, drag the fill handle at the bottom-right corner of E3 down the column to calculate quantities for other rows.

Calculate Remaining Order Quantities in WPS Spreadsheet
Use the same IF and OR formula in WPS Spreadsheet to return zero for blank or sufficient quantities and calculate the remainder when more is needed.
- 1. Open the spreadsheet: Open WPS Spreadsheet and choose Open to select your workbook.
- 2. Check the quantities: Enter the current quantity in C3 and the required quantity in D3, or leave C3 blank.
- 3. Enter the formula: Click E3, type =IF(OR(C3="",C3>=D3),0,D3-C3), and press Enter.
- 4. Copy and save: Drag the fill handle down for additional rows, then choose File > Save to save the workbook.

Frequently Asked Questions
What happens if C3 is blank?
The formula =IF(OR(C3="",C3>=D3),0,D3-C3) returns 0 when C3 is blank.
What if the current quantity exceeds the required quantity?
The C3>=D3 condition is true, so the formula returns 0 rather than a negative quantity.
Can I use the formula for multiple rows?
Yes. Enter it in E3 and drag the fill handle down. Excel adjusts the row references for each copied cell.
Does the formula work in WPS Spreadsheet?
Yes. Enter the same IF and OR formula in a result cell in WPS Spreadsheet, then press Enter.




