Function Problems

Return Zero for a Blank Cell or Unneeded Quantity in Excel

Huda QurayshiHuda Qurayshi Nov 14, 2026 869 views

Question details

The user needs an Excel formula that returns zero when an input cell is blank or the required quantity has been met.

Return Zero for a Blank Cell or Unneeded Quantity in Excel
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.
Before you start

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.

Solution 1Recommended

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.

1
Select the result cell

In Excel, click an empty cell such as E3, next to the quantities in C3 and D3.

2
Enter the formula

Type =IF(OR(C3="",C3>=D3),0,D3-C3) and press Enter.

3
Apply it to other rows

If needed, drag the fill handle at the bottom-right corner of E3 down the column to calculate quantities for other rows.

Use IF and OR to Calculate the Remaining Quantity
How the formula works: The OR test checks whether C3 is blank or at least equal to D3. If either condition is true, IF returns 0; otherwise, it returns D3-C3.
Calculate quantities in WPS

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. 1. Open the spreadsheet: Open WPS Spreadsheet and choose Open to select your workbook.
  2. 2. Check the quantities: Enter the current quantity in C3 and the required quantity in D3, or leave C3 blank.
  3. 3. Enter the formula: Click E3, type =IF(OR(C3="",C3>=D3),0,D3-C3), and press Enter.
  4. 4. Copy and save: Drag the fill handle down for additional rows, then choose File > Save to save the workbook.
Calculate remaining order quantities with IF and OR.Open and save Microsoft Excel XLSX files.Fill a formula down to calculate multiple rows.Use a familiar spreadsheet interface.
microsoft office alternative - wps office

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.