by Svetlana Cheusheva, updated on
The tutorial explains the syntax of the Google Sheets VLOOKUP function and shows how to use Vlookup formulas for solving real-life tasks.
When working with interrelated data, one of the most common challenges is finding information across multiple sheets. You often perform such tasks in everyday life, for example when scanning a flight schedule board for your flight number to get the departing time and status. Google Sheets VLOOKUP works in a similar way - looks up and retrieves matching data from another table on the same sheet or from a different sheet.
A widespread opinion is that VLOOKUP is one of the most difficult and obscure functions. But that's not true! In fact, it's easy to do VLOOKUP in Google Sheets, and in a moment you will make sure of it.
Tip. For Microsoft Excel users, we have a separate Excel VLOOKUP tutorial with formula examples.
The VLOOKUP function in Google Sheets is designed to perform a vertical lookup - search for a key value (unique identifier) down the first column in a specified range and return a value in the same row from another column.
The syntax for the Google Sheets VLOOKUP function is as follows:
The first 3 arguments are required, the last one is optional:
Search_key - is the value to search for (lookup value or unique identifier). For example, you can search for the word "apple", number 10, or the value in cell A2.
Range - two or more columns of data for the search. The Google Sheets VLOOKUP function always searches in the first column of range.
Index - the column number in range from which a matching value (value in the same row as search_key) should be returned.
The first column in range has index 1. If index is less than 1, a Vlookup formula returns the #VALUE! error. If it's greater than the number of columns in range, VLOOKUP returns the #REF! error.
Is_sorted - indicates whether the lookup column is sorted (TRUE) or not (FALSE). In most cases, FALSE is recommended.
In this case a Vlookup formula returns an approximate match. More precisely, it searches for exact match first. If an exact match is not found, the formula searches for the closest match that is less than or equal to search_key. If all values in the lookup column are greater than the search key, an #N/A error is returned.
At first sight, the syntax may seem a bit complicated, but the below Google Sheet Vlookup formula example will make things easier to understand.
Supposing you have two tables: main table and lookup table like shown in the screenshot below. The tables have a common column (Order ID) that is a unique identifier. You aim to pull the status of each order from the lookup table to the main table.
Now, how do you use Google Sheets Vlookup to accomplish the task? To begin with, let's define the arguments for our Vlookup formula:
Putting all the arguments together, we get this formula:
Enter it in the first cell (D3) of the main table, copy down the column, and you will get a result similar to this:
Is the Vlookup formula still difficult for you to comprehend? Then look at it this way:
As you already understood, the Google Sheets VLOOKUP function is a thing with nuances. Remembering these five simple facts will keep you out of trouble and help you avoid most common Vlookup errors.
Now that you have a basic idea of how Google Sheets Vlookup works, it's time to try your hand in making a few formulas on your own. To make the below Vlookup examples easier to follow, you can open the sample Vlookup Google sheet.
In real-life spreadsheets, the main table and Lookup table often reside on different sheets. To refer your Vlookup formula to another sheet within the same spreadsheet, put the worksheet name followed by an exclamation mark (!) before the range reference. For example:
The formula will search for the value in A2 in the range A2:A7 on Sheet4, and return a matching value from column B (2nd column in range).
If the sheet name includes spaces or non-alphabetical characters, be sure to enclose it in single quotation marks. For example:
Tip. Instead of typing a reference to another sheet manually, you can have Google Sheets insert it for you automatically. For this, start typing your Vlookup formula and when it comes to the range argument, switch to the lookup sheet and select the range using a mouse. This will add a range reference to the formula, and you will only have to change a relative reference (default) to an absolute reference. To do this, either type the $ sign before the column letter and row number, or select the reference and press F4 to toggle between different reference types.
In situations when you do not know the entire lookup value (search_key), but you do know a part of it, you can do a lookup with the following wildcard characters:
Let's say you want to retrieve information about a specific order from the table below. You cannot recall the order Id in full, but you remember that the first character is "A". So, you use an asterisk (*) to fill in the missing part, like this:
Better yet, you can enter the known part of the search key in some cell and concatenate that cell with "*" to create a more versatile Vlookup formula:
To pull the item:
To pull the amount:
Tip. If you need to search for an actual question mark or asterisk character, put a tilde (~) before the character, e.g. "~*".
One of the most significant limitations of the VLOOKUP function (both in Excel and Google Sheets) is that it cannot look at its left. That is, if the search column is not the first column in the lookup table, Google Sheets Vlookup will fail. In such situations, use a more powerful and more durable Index Match formula:
For example, to look up the A3 value (search_key) in G3:G8 (lookup_range) and return a match from F3:F8 (return_range), use this formula:
=INDEX($F$3:$F$8, MATCH (A3, $G$3:$G$8, 0))
The following screenshot shows this Index Match formula in action:
Another advantage of the Index Match formula compared to Vlookup is that it is immune to structural changes you make in the sheets since it references the return column directly. In particular, inserting or deleting a column in the lookup table breaks a Vlookup formula because the "hard-coded" index number becomes invalid, while the Index Match formula remains safe and sound.
For more information about INDEX MATCH, please see Why INDEX MATCH is a better alternative to VLOOKUP. Though the above tutorial targets Excel, INDEX MATCH in Google Sheets works exactly the same way, except for different names of the arguments.
In cases when the text case matters, use INDEX MATCH in combination with the TRUE and EXACT functions to make a case-sensitive Google Sheets Vlookup array formula:
Assuming the search key is in cell A3, the lookup range is G3:G8 and the return range is F3:F8, the formula goes as follows:
=ArrayFormula(INDEX($F$3:$F$8, MATCH (TRUE,EXACT($G$3:$G$8, A3),0)))
As shown in the screenshot below, the formula has no problem with distinguishing uppercase and lowercase characters such as A-1001 and a-1001:
Tip. Pressing Ctrl + Shift + Enter while editing a formula inserts the ARRAYFORMULA function at the beginning of the formula automatically.
Vlookup formulas are the most common but not the only way to look up in Google Sheets. The next and the final section of this tutorial demonstrates an alternative.
If you are looking for a visual formula-free way to do Google spreadsheet Vlookup, consider using the Merge Sheets add-on. You can get it for free from the Google Sheets add-ons store.
Once the add-on is added to your Google Sheets, you can find it under the Extensions tab:
With the Merge Sheets add-on in place, you are ready to give it a field test. The source data is already familiar to you: we will be pulling information from the Status column based on the Order ID:
In most cases, the add-on will pick up the entire table for you automatically. If it doesn't, either click the Auto select button or select the range in your main sheet manually, and then click Next:
In this example, we are pulling information from the Status column on the Lookup sheet into the Status column on the Main sheet:
Click Finish, allow the Merge Sheets add-on a moment for processing, and you are good to go!
Multiple VLOOKUP Matches is another Google Sheets tool for advanced lookup. As its name suggests, the add-on can return all matches, not just the first one as the VLOOKUP function does. Moreover, it can evaluate multiple conditions, look up in any direction, and return all or the specified number of matches as values or formulas.
Remembering that a picture is worth a thousand words, let's see how the add-on works on real-life data. Supposing, some orders in our sample table contain several items, and you wish to retrieve all the items of a specific order. A Vlookup formula is unable to do this, while a more powerful QUERY function can. The problem is this function requires knowledge of the query language or at least SQL syntax. Have no desire to spend days studying this? Install the Multiple VLOOKUP Matches add-on and get a flawless formula in seconds!
In your Google Sheet, click Add-ons > Multiple VLOOKUP Matches > Start, and define the lookup criteria:
For this example, we chose to return matches as formulas. So, you can now type any order number in F2, and the formula shown in the screenshot below will recalculate automatically:
To learn more about the add-on, visit the Multiple VLOOKUP Matches home page or get it now from the G Suite Marketplace.
That's how you can do Google Sheets lookup. I thank you for reading and hope to see you on our blog next week!
Table of contents