How to excel if blank

Excel for Microsoft 365 Excel for Microsoft 365 for Mac Excel 2021 Excel 2021 for Mac Excel 2019 Excel 2019 for Mac Excel 2016 Excel 2016 for Mac Excel 2013 Excel 2010 Excel 2007 Excel for Mac 2011 More…Less

Sometimes you need to check if a cell is blank, generally because you might not want a formula to display a result without input.

Formula in cell E2 is =IF(D2=1,"Yes",IF(D2=2,"No","Maybe"))

In this case we’re using IF with the ISBLANK function:

  • =IF(ISBLANK(D2),»Blank»,»Not Blank»)

Which says IF(D2 is blank, then return «Blank», otherwise return «Not Blank»). You could just as easily use your own formula for the «Not Blank» condition as well. In the next example we’re using «» instead of ISBLANK. The «» essentially means «nothing».

Checking if a cell is blank - Formula in cell E2 is =IF(ISBLANK(D2),"Blank","Not Blank")

=IF(D3=»»,»Blank»,»Not Blank»)

This formula says IF(D3 is nothing, then return «Blank», otherwise «Not Blank»). Here is an example of a very common method of using «» to prevent a formula from calculating if a dependent cell is blank:

  • =IF(D3=»»,»»,YourFormula())

    IF(D3 is nothing, then return nothing, otherwise calculate your formula).

Need more help?

The logical expression =»» means «is empty». In the example shown, column D contains a date if a task has been completed. In column E, a formula checks for blank cells in column D. If a cell is blank, the result is a status of «Open». If the cell contains value (a date in this case, but it could be any value) the formula returns «Closed».

The effect of showing «Closed» in light gray is accomplished with a conditional formatting rule.

Display nothing if cell is blank

To display nothing if a cell is blank, you can replace the «value if false» argument in the IF function with an empty string («») like this:

=IF(D5="","","Closed")

Alternative with ISBLANK

Excel contains a function made to test for blank cells called ISBLANK. To use the ISBLANK, you can revise the formula as follows:

=IF(ISBLANK(D5),"Open","Closed")

Home / Excel Formulas / IF Cell is Blank (Empty) using IF + ISBLANK

In Excel, if you want to check if a cell is blank or not, you can use a combination formula of IF and ISBLANK. These two formulas work in a way where ISBLANK checks for the cell value and then IF returns a meaningful full message (specified by you) in return.

In the following example, you have a list of numbers where you have a few cells blank.

Formula to Check IF a Cell is Blank or Not (Empty)

  1. First, in cell B1, enter IF in the cell.
  2. Now, in the first argument, enter the ISBLANK and refer to cell A1 and enter the closing parentheses.
  3. Next, in the second argument, use the “Blank” value.
  4. After that, in the third argument, use “Non-Blank”.
  5. In the end, close the function, hit enter, and drag the formula up to the last value that you have in the list.

As you can see, we have the value “Blank” for the cell where the cell is empty in column A.

=IF(ISBLANK(A1),"Blank","Non-Blank")

Now let’s understand this formula. In the first part where we have the ISBLANK which checks if the cells are blank or not.

And, after that, if the value returned by the ISBLANK is TRUE, IF will return “Blank”, and if the value returned by the ISBLANK is FALSE IF will return “Non_Blank”.

Alternate Formula

You can also use an alternate formula where you just need to use the IF function. Now in the function, you just need to specify the cell where you want to test the condition and then use an equal operator with the blank value to create a condition to test.

And you just need to specify two values that you want to get the condition TRUE or FALSE.

Download Sample File

  • Ready

And, if you want to Get Smarter than Your Colleagues check out these FREE COURSES to Learn Excel, Excel Skills, and Excel Tips and Tricks.

If Blank | If Not Blank | Highlight Blank Cells

Use the IF function and an empty string in Excel to check if a cell is blank. Use IF and ISBLANK to produce the exact same result.

If Blank

Remember, the IF function in Excel checks whether a condition is met, and returns one value if true and another value if false.

1. The IF function below returns Yes if the input value is equal to an empty string (two double quotes with nothing in between), else it returns No.

Check If a Cell is Blank

Note: if the input cell contains a space, it looks blank. However, if this is the case, the input value is not equal to an empty string and the IF function above will return No.

2. Use IF and ISBLANK to produce the exact same result.

IsBlank Function in Excel

Note: the ISBLANK function returns TRUE if a cell is empty and FALSE if not. If the input cell contains a space or a formula that returns an empty string, it looks blank. However, if this is the case, the input cell is not empty and the formula above will return No.

If Not Blank

In Excel, <> means not equal to.

1. The IF function below multiplies the input value by 2 if the input value is not equal to an empty string (two double quotes with nothing in between), else it returns an empty string.

Check If a Cell is Not Blank

2. Use IF, NOT and ISBLANK to produce the exact same result.

Not and IsBlank Function in Excel

Highlight Blank Cells

You can use conditional formatting in Excel to highlight cells that are blank.

1. For example, select the range A1:H8.

Select Cells

2. On the Home tab, in the Styles group, click Conditional Formatting.

Click Conditional Formatting

3. Click Highlight Cells Rules, More Rules.

More Rules

4. Select Blanks from the drop-down list, select a formatting style and click OK.

Select Blanks

Result.

Highlight Blank Cells

Note: visit our page about conditional formatting to learn much more about this cool Excel feature.

KEY PARAMETERS
Output Range: Select the output range by changing the cell reference («D5») in the VBA code.
Cell to Test: Select the cell that you want to check if it’s blank by changing the cell reference («C5») in the VBA code.
Worksheet Selection: Select the worksheet which captures the cells that you want to test if they are blank and return a specific value by changing the Analysis worksheet name in the VBA code. You can also change the name of this object variable, by changing the name ‘ws’ in the VBA code.
True and False Results: In this example if a cell is blank the VBA code will return a value of «No». If a cell is not blank the VBA code will return a value of «Yes». Both of these values can be changed to whatever value you desire by directly changing them in the VBA code.

NOTES
Note 1: If the cell that is being tested is returning a value of («») this VBA code will identify the cell as blank.
Note 2: If your True or False result is a text value it will need to be captured within quotation marks («»). However, if the result is a numeric value, you can enter it without the use of quotation marks.

KEY PARAMETERS
Output Range: Select the output range by changing the cell reference («D9») in the VBA code.
Cell to Test: Select the cell that you want to check if it’s blank by changing the cell reference («C9») in the VBA code.
Worksheet Selection: Select the worksheet which captures the cells that you want to test if they are blank and return a specific value by changing the Analysis worksheet name in the VBA code. You can also change the name of this object variable, by changing the name ‘ws’ in the VBA code.
True and False Results: In this example if a cell is blank the VBA code will return a value stored in cell C5. If a cell is not blank the VBA code will return a value stored in cell C6. Both of these values can be changed to whatever value you desire by either referencing to a different cell that captures the value that you want to return or change the values in those cells.

NOTES
Note 1: If the cell that is being tested is returning a value of («») this VBA code will identify the cell as blank.

KEY PARAMETERS
Output and Test Rows: Select the output rows and the rows that captures the cells that are to be tested by changing the x values (5 to 11). This example assumes that both the output and the associated test cell will be in the same row.
Test Column: Select the column that captures the cells that are to be tested by changing number 3, in ws.Cells(x, 3).
Output Column: Select the output column by changing number 4, in ws.Cells(x, 4).
Worksheet Selection: Select the worksheet which captures the cells that you want to test if they are blank and return a specific value by changing the Analysis worksheet name in the VBA code. You can also change the name of this object variable, by changing the name ‘ws’ in the VBA code.
True and False Results: In this example if a cell is blank the VBA code will return a value of «No». If a cell is not blank the VBA code will return a value of «Yes». Both of these values can be changed to whatever value you desire by directly changing them in the VBA code.

NOTES
Note 1: If the cell that is being tested is returning a value of («») this VBA code will identify the cell as blank.
Note 2: If your True or False result is a text value it will need to be captured within quotation marks («»). However, if the result is a numeric value, you can enter it without the use of quotation marks.

KEY PARAMETERS
Output and Test Rows: Select the output rows and the rows that captures the cells that are to be tested by changing the x values (9 to 15). This example assumes that both the output and the associated test cell will be in the same row.
Test Column: Select the column that captures the cells that are to be tested by changing number 3, in ws.Cells(x, 3).
Output Column: Select the output column by changing number 4, in ws.Cells(x, 4).
Worksheet Selection: Select the worksheet which captures the cells that you want to test if they are blank and return a specific value by changing the Analysis worksheet name in the VBA code. You can also change the name of this object variable, by changing the name ‘ws’ in the VBA code.
True and False Results: In this example if a cell is blank the VBA code will return a value stored in cell C5. If a cell is not blank the VBA code will return a value stored in cell C6. Both of these values can be changed to whatever value you desire by either referencing to a different cell that captures the value that you want to return or change the values in those cells.

NOTES
Note 1: If the cell that is being tested is returning a value of («») this VBA code will identify the cell as blank.

Понравилась статья? Поделить с друзьями:
  • How to enable macros in word
  • How to do formatting in word
  • How to email word documents
  • How to do filtering in excel
  • How to edit excel