## Summary

To test if a cell is not blank (i.e. has content), you can use a formula based on the IF function. In the example shown, the formula in cell E5 is:

``````=IF(D5<>"","Done","")
``````

As the formula is copied down it returns "Done" when a cell in column D is not blank and an empty string ("") if the cell is blank.

## Generic formula

``=IF(A1<>"","not blank","blank")``

## Explanation

The goal is to create a formula that returns "Done" in column E when a cell in column D is not blank (i.e., contains a value). In the worksheet shown, column D records the date a task is completed. If column D contains a date (i.e. is not empty), we can assume the task is complete. This problem can be solved with the IF function alone or with the IF function and the ISBLANK function. It can also be solved with the LEN function. All three approaches are explained below.

### IF function

The IF function runs a logical test and returns one value for a TRUE result, and another value for a FALSE result. Use IF to test for a blank cell like this:

``````=IF(A1="",TRUE) // IF A1 is blank
=IF(A1<>"",TRUE) // IF A1 is not blank``````

In the first example, we test if A1 is empty with ="". In the second example, the <> symbol is a logical operator that means "not equal to", so the expression A1<>"" means A1 is "not empty". In the worksheet shown, we use the second concept in cell E5 like this:

``````=IF(D5<>"","Done","")
``````

If D5 is "not empty", the result is "Done". If D5 is empty, IF returns an empty string ("") which displays as nothing in Excel. As the formula is copied down, it returns "Done" only for cells in column D that contain a value. To display both "Done" and "Not done", you can adjust the formula like this:

``````=IF(D5<>"","Done","Not done")
``````

### ISBLANK function

Another way to solve this problem is with the ISBLANK function. The ISBLANK function returns TRUE when a cell is empty and FALSE if not. To use ISBLANK only, you can rewrite the formula like this:

``````=IF(ISBLANK(D5),"","Done")
``````

Notice the TRUE and FALSE results have been reversed. The logic now is if cell D5 is blank. To maintain the original logic, you can nest ISBLANK inside the NOT function like this:

``````=IF(NOT(ISBLANK(D5)),"Done","")
``````

The NOT function reverses the output from ISBLANK.

### LEN function

One problem with testing for blank cells in Excel is that ISBLANK(A1) or A1="" will return FALSE if A1 contains a formula that returns an empty string. In other words, if a formula returns an empty string in a cell, Excel interprets the cell as "not empty" even though it looks empty. To work around this problem, you can use the LEN function to test for characters in a cell like this:

``=IF(LEN(A1)<>0,"Open","")``

This is a more literal formula. We are not asking Excel if A1 is blank, we are literally counting the characters in A1. The LEN function will return a non-zero number only when a cell contains actual characters. Using the LEN function this way works for cells containing formulas as well as cells without formulas.

### Conditional formatting

Another way to highlight tasks based on a cell that is not blank is to use conditional formatting. In the screen below, this formula is used to highlight rows that do not contain a completion date:

``=\$D5<>""``

This is an example of applying conditional formatting with a formula. When a date is entered in column D, the formatting will be applied. More examples here.

Author

### Dave Bruns

Hi - I'm Dave Bruns, and I run Exceljet with my wife, Lisa. Our goal is to help you work faster in Excel. We create short videos, and clear examples of formulas, functions, pivot tables, conditional formatting, and charts.