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.

Conditional formatting to highlight cells based on a cell that is not blank

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.

Conditional formatting to highlight cells based on a cell that is not blank

The ISBLANK function returns TRUE when a cell is empty and FALSE if not.

The logic now isif cell D5 is blank.

We are not asking Excel if A1 is blank, we are literally counting the characters in A1.

Conditional formatting to highlight cells based on a cell that is not blank

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.

When a date is entered in column D, the formatting will be applied.More examples here.

Conditional formatting to highlight cells based on a cell that is not blank

More than one condition can be tested by nesting IF functions.

For example, if A1 contains “apple”, ISBLANK(A1) returns FALSE.

NOT Function

The Excel NOT function returns the opposite of a given logical or Boolean value.

Conditional formatting to highlight cells based on a cell that is not blank

When given TRUE, NOT returns FALSE.

When given FALSE, NOT returns TRUE.

Use the NOT function to reverse a logical value.

Excel formula: If cell is blank

The IF function

Excel formula: If cell contains

Excel formula: Return blank if

Excel IF function

Excel ISBLANK function

Excel NOT function

Article image