Formula Errors

How to Keep Excel IF Results Blank When Input Cells Are Empty

Maira MehtabMaira Mehtab Nov 13, 2026 869 views

Question details

The user needs an Excel-compatible WPS Spreadsheets formula that returns a blank cell when the entire L6:W6 range is empty, then returns 2 if all cells in that range equal 2, otherwise returns 1.

How to Keep Excel IF Results Blank When Input Cells Are Empty
Product
WPS Spreadsheets
Device & OS
not provided
Scenario
The user is building or editing a worksheet formula that evaluates the range L6:W6 and expects a blank result when no input values have been entered.
Observed behavior
The original IF formula returns 1 when L6:W6 is empty because blank cells do not satisfy the all-2 condition and the formula falls through to its final result.
Before you start

Open the workbook in WPS Spreadsheets and confirm the target input range contains exactly 12 cells. If your actual range has a different number of cells, replace 12 with the correct cell count in the formulas below.

Solution 1Recommended

Use COUNTBLANK to Return a Blank Result for an Empty Input Range

Use this solution when you want the formula to check whether the entire L6:W6 range is blank before applying the all-2 rule.

The COUNTBLANK function counts empty cells in a range. If all 12 cells in L6:W6 are blank, the formula returns an empty string instead of continuing to the IF logic.

1
Select the formula cell

Click the cell in WPS Spreadsheets where you want the result to appear, such as the cell currently containing the original IF formula.

2
Enter the COUNTBLANK formula

Type or paste =IF(COUNTBLANK(L6:W6)=12,"",IF(AND(L6=2,M6=2,N6=2,O6=2,P6=2,Q6=2,R6=2,S6=2,T6=2,U6=2,V6=2,W6=2),2,1)).

3
Press Enter and verify

Press Enter. Empty input cells now show a blank cell, all 2 values show 2, and any other entered values show 1.

Use COUNTBLANK to Return a Blank Result for an Empty Input Range
Formula fixed: The formula now returns an empty string only when all cells in L6:W6 are blank.

Fix the Blank-Cell IF Formula in WPS Spreadsheets

Use WPS Spreadsheets to directly edit the formula so it returns blank for empty input cells, returns 2 when all L6:W6 cells equal 2, and returns 1 otherwise. The formula uses standard functions that are compatible with Microsoft Excel.

  1. 1. Open WPS Spreadsheets: Launch WPS Office and open the workbook that contains the formula in WPS Spreadsheets.
  2. 2. Select the formula cell: Click the cell where the IF formula should return the result.
  3. 3. Insert the corrected formula: Type the recommended COUNTBLANK formula into the selected cell or formula bar.
  4. 4. Press Enter to apply: Press Enter to calculate and confirm that blank input cells stay blank.
  5. 5. Save the workbook: Click the Save icon or use Ctrl+S to keep the corrected formula.
Correctly handles blank-cell logic in IF formulasFull Microsoft Excel .xlsx formula compatibilityFree, lightweight Office suite with familiar spreadsheet toolsNo reformatting needed when switching from Excel to WPS Spreadsheets
microsoft office alternative - wps office

Frequently Asked Questions

Why does my Excel IF formula return 1 when L6:W6 is blank?

Because the condition AND(L6=2,...,W6=2) is not true for blank cells, so execution continues to the final value 1. Add a COUNTBLANK or COUNTIFS blank-range check at the start of the formula.

Can I use COUNTIFS instead of COUNTBLANK?

Yes. Use =IF(COUNTIFS(L6:W6,"")=12,"",IF(COUNTIFS(L6:W6,2)=12,2,1)). It returns blank when all 12 cells are empty, 2 when all are 2, and otherwise 1.

What should I change if my input range has more or fewer than 12 cells?

Replace 12 with the number of cells in your actual range. For example, count the cells in the new range and compare the blank-cell count to that total.

Does this formula work in both WPS Spreadsheets and Microsoft Excel?

Yes. COUNTBLANK and COUNTIFS are standard functions in both applications, so the formula is compatible with .xlsx workbooks.

How can I show a truly empty cell instead of an empty string?

A formula cannot return a true blank value, but returning "" makes the cell appear blank. You can combine it with display or formatting options if needed.