HomeGoogle DocsSpreadsheetHow to Skip Blank Cells in Vlookup in Google Sheets

How to Skip Blank Cells in Vlookup in Google Sheets

Published on

You can very easily skip blank cells in Vlookup in Google Sheets. You can either use the FILTER function or the QUERY function together with Vlookup in Google Sheets.

It may not be as much simpler in Excel since the lack of these two functions. Now about how to skip blank cells in Vlookup.

Vlookup searches down the first column in a table for your given search key. If found, the formula would return value from any cell in that found row. This you may already know.

The returned cell value can be any values (text, numeric or date) or may sometimes blank. If the cell is blank, Vlookup doesn’t skip the row. Instead, it would return blank. But you can skip blank rows in Vlookup.

Then how to skip blank cells in Vlookup in Google Sheets?

Example: Skip Blank Cells in Vlookup in Google Sheets

In the above example, my lookup search key is “B”. I want a Vlookup formula that would search down Column A for the value “B” and return value from the same row in column B. If you use Vlookup in this case, it would return blank.

=vlookup(D1,A1:B7,2,FALSE)

As you can see, Vlookup will find the search key “B” in cell A2. What we want is the result of column B in that row. That means the value in cell B2.

Here, cell B2 doesn’t contain any value and it’s blank. So Vlookup will only return blank. I want to skip this row and search for the second appearance of “B” in column A, i.e. in cell A5 and return the value from B5 since it’s not blank. How?

How to Skip Blank Cells in Vlookup in Google Sheets

You can tweak Google Sheets Vlookup function in many ways. Skipping blank cells are also possible.

You can use Vlookup to return an Array result, for Image Lookup, to Return Multiple Columns, Case Sensitive Vlookup etc.

If you are interested to learn advanced Vlookup formulas, I suggest you search this page using the search term “Vlookup” in the search field that you can find on the top of this page.

The Formula to Skip Blank Cells in Vlookup

The below Vlookup formula is based on the above Sample data and cell references. This Vlookup formula can skip blank cells.

=VLOOKUP(D1,query(A1:B7,"Select * where B is not null"),2,FALSE)

Before taking you to the formula explanation, first, we can see the Vlookup Syntax.

VLOOKUP(search_key, range, index, [is_sorted])

If you analyze the formula, you can understand that in my formula that to skip blank cells in Google Sheets, the “range” is not a direct table/array reference. Instead, it’s replaced by a Query formula. This Query is the soul of my formula. What does it do?

The Query part in the above formula, filtered out rows that contain no values (blank) in column B. Here is that Query formula result for your reference.

Query in Google Sheets Vlookup

This’s our actual Vlookup range and the Vlookup formula searches down column 1 in this table to find the search key “B” and properly return the value from Column B.

This time since there are no blank cells, there is no issue with the blank cell as output. That’s all. This way you can skip blank cells in Vlookup in Google Sheets. Enjoy!

Prashanth KV
Prashanth KV
Your Trusted Google Sheets and Excel Guide Prashanth KV brings a wealth of experience in Google Sheets and Excel, cultivated through years of work with multinational corporations in Mumbai and Dubai. As a recognized Google Product Expert in Docs Editors, Prashanth shares his expertise through insightful blogging since 2012. Explore his blog for practical tips and guidance on maximizing your spreadsheet skills.

Appointment Schedule Template in Google Sheets

An appointment schedule template in Google Sheets can assist you in efficiently managing your...

Creating Sequential Dates in Equally Merged Cells in Google Sheets

Do you know how to create sequential dates in equally merged cells across a...

Running Total By Month in Excel

This tutorial demonstrates how to calculate the running total by month in a range...

SORT and SORTBY – Excel Vs Google Sheets

While Excel offers the SORT and SORTBY functions for sorting a table, Google Sheets...

More like this

Appointment Schedule Template in Google Sheets

An appointment schedule template in Google Sheets can assist you in efficiently managing your...

Creating Sequential Dates in Equally Merged Cells in Google Sheets

Do you know how to create sequential dates in equally merged cells across a...

Interactive Random Task Assigner in Google Sheets

You have multiple tasks and multiple people. Here's a fun way to randomly assign...

5 COMMENTS

  1. Hi Prashanth,

    Thanks for the article! What do I do when my search key is not “B” but a random string which also constantly changes when I copy the formula to other cells? How would I have to tweak the “Select * where B is not null” part? Thanks!

  2. Thanks for the interesting post. Is it possible that if VLOOKUP one column blank then it automatically selects the next column? If yes, please let me know.

    Thanks

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.