Get first non-blank value in a list

An excel formula to get first non-blank value in a list

Related Functions

Sponsored Link

 Get first non-blank value in a list
{=INDEX(range,MATCH(FALSE,ISBLANK(range),0))}

If you need to get the first non-blank value (text or number) in a in a one-column range you can use an array formula based on the INDEX, MATCH, and ISBLANK functions.

In the example the formula we're using is:

 
{=INDEX(B3:B11,MATCH(FALSE,ISBLANK(B3:B11),0))}

This is an array formula and must be entered with Control-Shift-Enter.

How this formula works

So, the gist of the problem is this: We want to get the first non-blank cell, but we don't have a direct way to do that in Excel. We could use VLOOKUP with a wildcard * (see link below), but that will only work for text, not numbers.

So, we need to build the functionality we need by nesting formulas. On way to do that is to use an array function that "tests" cells and returns an array of TRUE/FALSE values that we can then match with MATCH.

Working from the inside out, ISBLANK evaluates the cells in the range B3:B11 and returns and array result that looks like this:

{TRUE;FALSE;TRUE;FALSE;FALSE;TRUE;TRUE;TRUE;TRUE}

Each FALSE represents a cell in the range that is not blank.

Next, MATCH looks for FALSE inside the array and returns the position of the first match found, in this case 2. At this point, the formula in the example now looks like this:

 
{=INDEX(B3:B11,2,0))}

Finally, the INDEX function takes over and gets the value at position 2 in the array, in the case the number 10.

 

Sponsored Link

0 votes. 0 / 5