Use Last Month’s Budget Value for Blank or Zero Cells in WPS Spreadsheets
Question details
Calculate a budget total using the current month’s value for each row, or the previous month’s value when the current value is blank or zero.

- Product
- Spreadsheet software, including WPS Spreadsheets and Microsoft Excel
- Device & OS
- not provided
- Scenario
- The previous month’s values are in C15:C44 and the current month’s values are in D15:D44.
- Observed behavior
- The desired total should include one value per row: the current month’s value when it is nonzero, otherwise the previous month’s value.
Check that column C contains the previous month’s numeric values and column D contains the current month’s values. Adjust the cell references if your budget uses different columns or rows.
Use an IF formula for each budget row
Use a helper column to handle both blank and zero current-month cells, including cells containing formulas that return an empty string.
In an empty helper cell such as E15, enter =IF(OR(D15="",D15=0),C15,D15).
Select E15 and drag its fill handle down through E44 to apply the formula to each budget row.
In an empty total cell, enter =SUM(E15:E44). Check a few rows to confirm that blank or zero values in column D use the corresponding values from column C.

Use SUMIF when missing current-month values are zeros
Use a single formula to total the current month and add previous-month values for rows identified by the zero criterion.
Calculate Your Budget Fallback Total in WPS Spreadsheets
Use WPS Spreadsheets to choose the previous month’s value whenever the current month is blank or zero, then sum the selected values.
- 1. Open the budget: Open your workbook in WPS Spreadsheets and locate the previous- and current-month columns.
- 2. Add the formula: In E15, enter =IF(OR(D15="",D15=0),C15,D15), adjusting the references if needed.
- 3. Fill the helper column: Drag the fill handle from E15 down to E44 to calculate the selected value for each row.
- 4. Sum the values: Enter =SUM(E15:E44) in an empty cell to display the budget total.

Frequently Asked Questions
How do I use last month’s value when the current cell is blank or zero?
For a current value in D15 and a previous value in C15, enter =IF(OR(D15="",D15=0),C15,D15) in an empty cell.
Will the IF formula also handle a cell that contains a formula returning an empty string?
Yes. The D15="" test in =IF(OR(D15="",D15=0),C15,D15) also checks for an empty-string result.
Can I calculate the total without a helper column?
You can use =SUM(D15:D44)+SUMIF(D15:D44,0,C15:C44). Check the result against your blank and zero entries; use the helper-column method if missing entries do not behave as expected.
What happens if the current month’s value is negative?
The IF formula uses the negative current-month value because it is neither blank nor zero.




