 # Find first non-blank item in a list with formulas

Share

Blank cells are an invisible pain in the analysis. Dealing with them is frustrating, time-consuming and often very complex. At chandoo.org, we are not big fans of blank cells. That is why we wrote:

Today, lets talk about one more scenario. Lets say you want to find out the first non-blank item in a list. How would you do it? ## Finding first non-blank item in a list

Lets say our list is in the range B3:B100.

Without using formulas

If you just want to get the first non-blank item in a list and do not want to use formulas, then you can remove all the blank items from the list. To do this:

1. Select entire list
2. Press F5, click on special
3. Choose blanks, click ok.
4. Press CTRL –
5. Remove rows (or shift cells up as needed).
6. Done!

Now that the blank cells are gone, just refer to B3 to get the first non-blank item in the list.

### Using formulas

Although the non-formula approach works, it is manual. That means every time your data changes, you must repeat the steps. Not very cool, especially if you call yourself awesome. So, lets use a powerful formula to get that first non blank item in our list.

First see the formula:

`=VLOOKUP("*", B3:B100, 1,FALSE)`

How it works?

We want to lookup for first cell that contains something. It does not matter what that value is.

That is what * does. * is a wild card in Excel. When you ask VLOOKUP to find *, it finds the first cell that contains anything.

NOTE: This approach finds first cell that contains any TEXT. So if the first non-blank cell is a number (or date, % or Boolean value), the formula shows next cell that contains text.

### How to find first non-blank value (text or number)?

If you want to find first non-blank value, whether it is text or number, then you can use below array formula.

`=INDEX(B3:B100, MATCH(FALSE, ISBLANK(B3:B100), 0))`

Make sure you press CTRL+Shift+Enter after typing this formula.

#### How this formula works?

ISBLANK(B3:B100) portion: This gives us list of TRUE / FALSE values depending on the 98 cells in B3:B100 are blank or not. It looks like this:

`{TRUE;TRUE;TRUE;FALSE;FALSE;FALSE;FALSE; ...}`

MATCH(FALSE, ISBLANK(…), 0) portion: Once we have the TRUE / FALSE values, we just need to find the first FALSE value (ie, first non-blank cell). That is what this MATCH function does. It finds an exact match of FALSE value in the list.  (Related: Using MATCH Formula)

INDEX(B3:B100, MATCH(…)) portion: Once we know which cell is the first non-blank cell, we need its value. That is what INDEX does. (Related: Introduction to INDEX formula)

## Home work for you

If you like this formula and want some challenge, read on.

For these home work problems, use the range B3:B100 or named range list in your formulas.

1. Can you think of some other formulas to find first non-blank cell?
2. What formula gives 2nd non-blank cell value?
3. What formula gives last non-blank cell value?

## Drawing a blank when working on lookups?

If you are giving blank stares whenever your boss asks for lookup related stuff, then you are going to love this. My latest publication, The VLOOKUP Bookis a comprehensive guide to VLOOKUP, INDEX, MATCH, LOOKUP and other techniques to lookup any data and answer questions with confidence.  Comprehensive and easy to understand This is a book for everyone who uses Vlookup. Most of us think… Oh.. I already know the function. But this book will open your eyes to some brilliant techniques. – By Dr. Nitin Paranjape Solid introduction to lookup functions This books does a wonderful job of taking each of the lookup functions available in Excel, breaking them down to a simple, easy-to-understand level. – by Lucas Moraga

### Get FREE Excel + Power BI Tips

Simple, fun and useful emails, once per week.

Learn & be awesome.

### Welcome to Chandoo.org

Thank you so much for visiting. My aim is to make you awesome in Excel & Power BI. I do this by sharing videos, tips, examples and downloads on this website. There are more than 1,000 pages with all things Excel, Power BI, Dashboards & VBA here. Go ahead and spend few minutes to be AWESOME.

Read my storyFREE Excel tips book

Excel School made me great at work.
5/5

– Brenda

Power Query, Data model, DAX, Filters, Slicers, Conditional formats and beautiful charts. It's all here.

Still on fence about Power BI? In this getting started guide, learn what is Power BI, how to get it and how to create your first report from scratch. ### 9 Box grid for talent mapping – HR for Excel – Template & Explanation

9 box grid is a popular method for talent mapping. Download this free excel template for tracking and visualizing your employee performance & potential data.

In this article, I explain about powerful excel features like FILTER(), SORT() and CONCATENATEX() to create a similar 9 box talent map grid for your data.

## Related Tips

### 23 Responses to “Find first non-blank item in a list with formulas”

1. Rob T says:

I know using helper columns is not very awesome, but in this instance I found a helper column very.... helpful:

In the helper column, the formula =COUNTA(\$B\$3:\$B3) in row 3, then copied down to row 100 gives the n we need in the "find the n'th non-blank value" challenge).

Then it's simple to construct the formula (assuming helper column is C and we put the required n into C1):
=INDEX(B3:B100,MATCH(C1,C3:C100,0))

The last non-blank value can be found by putting =MAX(C3:C100) into cell C1. Adding a -1 to this will result in the penultimate non-blank value.

I tried to shoehorn the helper column into one array function using some form of \$B\$3:(B3:B100) but couldn't find any way to make that work. Is there a way?

2. JLeno says:

To find the nth nonblank value without a helper colum (array entered):
=INDEX(\$B\$1:\$B\$100,SMALL(IF(NOT(ISBLANK(\$B\$3:\$B\$100)),ROW(\$B\$3:\$B\$100)),COUNTA(C\$1:C2)+1))

The IF function returns FALSE for blank cells and the row number for all nonblank cells.

The SMALL function returns the nth lowest row number of nonblank cells, based on the number of nonblank values it has already found (using the COUNTA function).

The INDEX array must be based on the first row to work correctly, or otherwise include a workaround to find the right row number of the array.

Cheers 🙂
Any tidier suggestions?

3. Arun says:

Answer to second home work question:

{=INDEX(range,MATCH(FALSE,ISBLANK(range),0)+2)}

• Arun says:

Answer to second home work question:

{=INDEX(range,MATCH(FALSE,ISBLANK(range),0)+1)}

• Kitty Fishy says:

my frustration over finding a cleaner method led me to the Microsoft support page:

``` {=INDEX(range,SMALL(IF(ISBLANK(range),"",ROW(range)),n)-ROW(range)+1)} ```

Replace SMALL() with LARGE() if you wish to search from the end instead.

• Mark duchesne says:

This solution also works if you replace the "-ROW(range)+1" part at the end with "-1"

I am always amazed at how many different ways things can be worked out in excel 🙂

• Ufoo says:

Excuse me but it would work as you say if the range starts at B1. Correct me if I am wrong.

• Veronica says:

THANK YOU SO MUCH! ThIs is the only one that worked for me out of all of the comments!

• Veronica says:

Never mind it didn't work.. 🙁

4. Mark Duchesne says:

Not pretty i know but this is how i did it for the nth item.

Where D1 = the nth occurence

=INDEX(RANGE,(SUM(SMALL(IF(NOT(ISBLANK(RANGE))*ROW(RANGE)>0,NOT(ISBLANK(RANGE))*ROW(RANGE)),\$D\$1)))-1,1)

Thanks Chandoo for the tips.

5. Andre says:

Also not a pretty one, but works quite well. this is the find the n'th non-blank entry in the column

`{=IFERROR(INDEX(range,SMALL(((range)<>"")*ROW(range),COUNTIF(range,"")+ROW())),"")}`

6. Harish Garg says:

These are also looks easy.

Non-blank cell that contain number =INDEX(A1:A27,SMALL(IF(ISNUMBER(A1:A27),ROW(A1:A27)),1))

Non-blank cell that contain text:
=INDEX(A1:A27,SMALL(IF(ISTEXT(A1:A27),ROW(A1:A27)),1))

Second non-blank cell:
=INDEX(A1:A27,SMALL(IF((A1:A27)"",ROW(A1:A27)),2))

Last non-blank cell:
=INDEX(A1:A27,LARGE(IF((A1:A27)"",ROW(A1:A27)),1))

7. Trouttrap2 says:

Does this work if a number is the first non-blank in the series?
=VLOOKUP("*",B3:B100,1,FALSE)

• Trouttrap2 says:

Never mind. I found the note:
NOTE: This approach finds first cell that contains any TEXT. So if the first non-blank cell is a number (or date, % or Boolean value), the formula shows next cell that contains text.

8. […] Find first non-blank item in a list with formulas […]

9. John Waddell says:

I am looking for what should be a simple formula but cannot find it anywhere. I have several worksheets, each for a separate bank account.
All I wan to do is look up the "balance" column and print the latest balance in an account summary. i.e. look down the "balance" column until a blank cell is found, then report the value in the cell above (which will be the latest balance). Of course this changes each time a debit or credit is recorded therefore the formula needs to look for the first blank cell, then move up one cell to find the data.

Any suggestions? TY for any help.

10. Avinash Shetty says:

1) Can you think of some other formulas to find first non-blank cell?
Ans: =INDEX(A1:A5,COUNTBLANK(A1:A5)+1)

2) What formula gives 2nd non-blank cell value?
Ans: Replace the value 1 from the above formula with 2nd 3rd whichever value you want.

11. Avinash Shetty says:

Here is the answer to the 3rd question...

3) What formula gives last non-blank cell value?

=INDEX(A1:A10,MAX(MATCH(9^9,A1:A10),MATCH(REPT("z",255),A1:A10)))

12. henry says:

I am looking for a way to retrieve the column heading for the first non-blank value (text or number) it finds in a row.

Suppose I have the following
1 Results: - Column B - Column C - Column D
2 Column C - - 1 -
3 Column B - 5 - -
Do I use the same formula and add another function?

thanks

13. Cristian says:

Hello,

Please help me with this. I want to enter in a cell the fist non-blank value, going from right to left. For instance, I write my formula in cell J21, and the first non-blank value going from right to left in row 21 is in cell d21(a21, b21 and c21 also have some values inside). I want the function to return the same value that is in cell d21.

How can I do it?
Thank you

14. JeteMc says:

Awesome!!

15. Jefferson says:

Thanks, very good excel knowledge

16. Reuben says:

This is AWESOME for rows, but what if you need to do it for columns instead. say you have columns A:D(populated from another sheet), where any one of those columns could be completely blank. how could you modify this formula to do the same thing left to right for columns that it does top to bottom for rows?

### Get FREE Excel & Power-BI Newsletter

One email per week with Excel and Power BI goodness. Join 100,000+ others and get it free.