# If not blank multiple cells

To test multiple cells, and return the value from the first non-blank cell, you can use a formula based on the IF function. In the example shown, column D holds task complete dates. The formula in cell F5 is:

which returns a value from the first non-blank cell, B5, C5, D5, or E5, respectively. When all cells are blank, the formula returns "no value". The value returned when all cells are blank can be adjusted as desired.

In Excel, empty double quotes ("") mean empty string. The <> symbol is a logical operator that means "not equal to", so the following expression means "A1 is not empty":

=A1<>"" // A1 is not empty

This expression is used four times in the formula shown in the example, in order to test four different cells in a particular order.

The overall structure of this formula is what is called a "nested IF formula". Each IF statement checks a cell to see if it not empty. If not empty, the IF returns the value from that cell. If the cell is empty, the IF statement hands off processing to another IF statement:

The flow of a nested IF is easier to visualize if you add line breaks to the formula. Below, line breaks have been added to the formula to line up the IF statements:

### With ISBLANK

Excel contains the ISBLANK function, which returns TRUE when a cell is blank:

=ISBLANK(A1) // A1 is blank

The behavior can be "reversed" by nesting the ISBLANK function inside the NOT function:

=ISBLANK(A1) // A1 is not blank

The formula above can be re-written to use ISBLANK as follows:

## Excel Formula Training

Formulas are the key to getting things done in Excel. In this accelerated training, you'll learn how to use formulas to manipulate text, work with dates and times, lookup values with VLOOKUP and INDEX & MATCH, count and sum with criteria, dynamically rank values, and create dynamic ranges. You'll also learn how to troubleshoot, trace errors, and fix problems. Instant access. See details here.