What VLOOKUP does and when to use it
VLOOKUP is a formula that searches for a value in the first column of a table and returns a value from another column in that same row. Use it when you have two related lists of data and need to pull information from one list based on a match in the other.
A concrete example: you have a spreadsheet with product codes in column A and prices in column B. In a different part of your sheet, you have a list of product codes that customers ordered. VLOOKUP finds each product code in your price table and returns the matching price so you can see what each order cost.
VLOOKUP only works when the data you're searching for is to the left of the data you want to return. If your lookup column is on the right side of the column you need, use INDEX and MATCH instead (a more flexible pair of formulas that work the same way).
Key Takeaways
- VLOOKUP syntax is =VLOOKUP(lookup_value, table_array, col_index_num, [range_lookup]) — the lookup value is what you're searching for, the table array is the entire data range, and col_index_num tells Excel which column to return.
- The lookup column must be the leftmost column in your table array, or VLOOKUP will not find the match.
- Use FALSE (or 0) as the fourth argument for exact matches, which is what you want in most cases like matching product codes or employee IDs.
- If VLOOKUP returns #N/A, the lookup value does not exist in your table, or there is a space or spelling difference between the two values.
- Wrap your VLOOKUP in IFERROR to display a custom message instead of #N/A when no match is found.
The four parts of a VLOOKUP formula
A VLOOKUP formula has four parts, separated by commas. Here is the structure:
=VLOOKUP(lookup_value, table_array, col_index_num, range_lookup)
lookup_value is the piece of data you are searching for. This is usually a cell reference (like B2) or a specific value in quotes (like "Widget-A"). In the product code example, this would be the product code the customer ordered.
table_array is the range of cells that contains both your lookup column and the column you want to return. If your product codes are in column A and prices are in column B, your table array is A:B (the entire columns) or A2:B500 (a specific range). The lookup column must always be the first column in this range.
col_index_num is the column number within your table array that contains the value you want to return, counting from the left. If your table array is A:B, column A is 1 and column B is 2. If your table array is A:D, column D is 4. In the price example, you would use 2 because the price is in the second column.
range_lookup is either FALSE (or 0) for an exact match, or TRUE (or 1) for an approximate match. Use FALSE in almost all cases — it means "find this exact value or return an error." TRUE is only useful when your lookup column is sorted in ascending order and you want to find the closest match below your search value.
Building a VLOOKUP step by step
Start with a simple example. Suppose you have a price list in columns A and B: product codes in A and prices in B. You want to look up the price for product code "Widget-A".
Click the cell where you want the result to appear. Type the formula: =VLOOKUP("Widget-A",A:B,2,FALSE)
Press Enter. Excel searches column A for "Widget-A", finds it, and returns the value from column B in that same row.
To make this formula reusable, replace the hardcoded product code with a cell reference. If the product code you want to look up is in cell D2, write: =VLOOKUP(D2,A:B,2,FALSE) Now you can copy this formula down and it will look up whatever product code is in column D of each row.
Fixing the most common VLOOKUP errors
#N/A error means the lookup value was not found in the first column of your table. Check for extra spaces before or after the value, different capitalization (WIDGET-A vs widget-a), or a typo. Use the TRIM function to remove extra spaces: =VLOOKUP(TRIM(D2),A:B,2,FALSE)
#REF! error means your table array reference is broken, usually because you deleted a column or the range is invalid. Double-check that your table array includes both the lookup column and the return column, and that the columns still exist.
#VALUE! error usually means you used TRUE or FALSE in the wrong format, or your col_index_num is not a number. Make sure you wrote FALSE (not "FALSE" in quotes) and that col_index_num is a whole number like 2 or 3, not a cell reference.
The formula returns the wrong value — this usually happens when your lookup column is not the leftmost column in your table array. VLOOKUP always searches the first column of the range you give it. If you need to search a column on the right, use INDEX and MATCH instead.
Using IFERROR to handle missing matches
When a VLOOKUP does not find a match, it returns #N/A, which looks like an error in your spreadsheet. If you want a cleaner result, wrap your VLOOKUP in the IFERROR function.
=IFERROR(VLOOKUP(D2,A:B,2,FALSE),"Not found")
This formula does the same VLOOKUP, but if it returns an error, IFERROR displays "Not found" instead. You can replace "Not found" with any text you want, or leave it blank with empty quotes: =IFERROR(VLOOKUP(D2,A:B,2,FALSE),"")
IFERROR is useful when you are building a report and do not want error messages to distract from the data, or when you are matching against a list that may not contain every value.
When VLOOKUP does not work and what to use instead
VLOOKUP only searches the leftmost column of your table. If the column you want to search is on the right side of the column you want to return, VLOOKUP cannot do it.
For example, if your table has prices in column A and product codes in column B, and you want to search by product code to find the price, VLOOKUP will not work because the lookup column (B) is to the right of the return column (A).
In this case, use INDEX and MATCH together. The formula looks like: =INDEX(A:A,MATCH(D2,B:B,0)) This searches column B for the value in D2 and returns the corresponding value from column A. INDEX and MATCH work in any direction and are more flexible than VLOOKUP, though they take a moment longer to learn.
If you need to search multiple columns and return values from different places, or if your data is in a database rather than a spreadsheet, consider using a pivot table or learning SQL instead.
Frequently Asked Questions
Can VLOOKUP search for partial text matches?
VLOOKUP finds exact matches by default. To search for partial text, use a wildcard: =VLOOKUP("Widget*",A:B,2,FALSE) will find "Widget-A", "Widget-B", and so on. However, wildcards only work when range_lookup is FALSE and the lookup column contains text, not numbers.
What is the difference between FALSE and 0 in VLOOKUP?
FALSE and 0 mean the same thing in VLOOKUP — both request an exact match. TRUE and 1 also mean the same thing — both request an approximate match. Use whichever you prefer; FALSE and TRUE are more readable, but 0 and 1 are shorter to type.
Can I use VLOOKUP across multiple sheets?
Yes. Include the sheet name in your table array reference: =VLOOKUP(D2,PriceList!A:B,2,FALSE) This searches columns A and B on the sheet named "PriceList". If your sheet name contains spaces, wrap it in single quotes: =VLOOKUP(D2,'Price List'!A:B,2,FALSE)
Why does VLOOKUP return the first match when there are duplicates?
VLOOKUP stops at the first match it finds. If your lookup column contains duplicate values, VLOOKUP will always return the result from the first occurrence. If you need to match based on multiple criteria, use INDEX and MATCH with multiple conditions, or add a helper column to make each lookup value unique.
Is VLOOKUP slow on large spreadsheets?
VLOOKUP can slow down a spreadsheet with thousands of rows and many formulas. If performance becomes a problem, consider using a pivot table to summarize your data instead, or breaking your data into smaller ranges. For very large datasets, a database tool like Access or SQL will be faster than Excel.