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.
IF function
The IF function runs a logical test and returns one value for a TRUE result, and another value for a FALSE result. You can use IF to test for a blank cell like this: 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 idea in cell E5 like this: If D5 is “not empty”, the result is “Done”. If D5 is empty, IF returns an empty string ("") which displays as nothing. As the formula is copied down, it returns “Done” only when a cell in column D contains a value. To display both “Done” and “Not done”, you can adjust the formula like this:
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 directly, you can rewrite the formula like this: Notice the TRUE and FALSE results have been swapped. The logic now is if cell D5 is blank. To maintain the original logic, you can nest ISBLANK inside the NOT function like this: The NOT function simply reverses the result returned by ISBLANK.
LEN function
One problem with testing for blank cells in Excel is that ISBLANK(A1) or A1="" will both 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”. To work around this problem, you can use the LEN function to test for characters in a cell like this: This is a much 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 positive number only when a cell contains actual characters.
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.