Formula Errors

Excel IF Formula for Multiple Conditions and Blank Cells

Steve KSteve K Nov 18, 2026 869 views

Question details

Create an Excel formula that returns different results for X, Y, other values, and blank cells.

Excel IF Formula for Multiple Conditions and Blank Cells
Product
Microsoft Excel
Device & OS
not provided
Scenario
Evaluate a value in column D and return a matching description or a blank result.
Observed behavior
The desired formula returns X Blah for X, Y Blah for Y, an empty result for a blank cell, and Something Else for other values.
Before you start

Identify the cell containing the value to test and the cell where you want the result. The example uses D2 as the input and can be entered in another cell, such as E2.

Solution 1Recommended

Use a Nested IF Formula to Check Values and Blanks

Use this formula when one cell can contain X, Y, another value, or no value.

1
Select the result cell

In Excel, select E2 or another empty cell where you want the result to appear.

2
Enter the formula

Type =IF(D2="X","X Blah",IF(D2="Y","Y Blah",IF(D2="","","Something Else"))) and press Enter.

3
Apply it to other rows

Select the formula cell and drag its fill handle down to evaluate the corresponding cells in column D.

Use a Nested IF Formula to Check Values and Blanks
Check the blank test: Use D2="" with no space between the quotation marks. A cell containing a space is not treated as blank. The formula returns an empty string for a blank input.
Work with formulas in WPS Office

Evaluate Multiple Conditions in WPS Spreadsheet

Use the same nested IF formula in WPS Spreadsheet to return a result for X, Y, other values, or a blank input.

  1. 1. Open your spreadsheet: Open WPS Spreadsheet and choose Open to select your workbook.
  2. 2. Select a result cell: Click E2 or another empty cell beside the value in D2.
  3. 3. Enter the IF formula: Type =IF(D2="X","X Blah",IF(D2="Y","Y Blah",IF(D2="","","Something Else"))) and press Enter.
  4. 4. Fill other rows: Drag the fill handle from the formula cell down to apply the formula to additional rows.
Apply nested IF formulas to multiple rows.Open and edit Microsoft Excel XLSX files.Use a familiar spreadsheet interface.
microsoft office alternative - wps office

Frequently Asked Questions

How do I make the formula return a blank result?

Use D2="" to test for a blank value and "" as the result, as in IF(D2="","","Something Else").

Why does a cell containing a space return Something Else?

A space is a character, so it does not match the empty string in D2="". Remove the space from D2 if the cell should be blank.

How do I change the text returned for X or Y?

Edit the formula in the formula bar and replace "X Blah" or "Y Blah" with your preferred text, keeping the quotation marks.

What if Excel reports a formula syntax error?

Check that the parentheses and quotation marks match. Depending on your regional settings, you may also need to replace the commas between arguments with semicolons.