VLOOKUP is a spreadsheet function that searches for a value in the leftmost column of a table and returns a corresponding value from a specified column to the right. It is most commonly used in Microsoft Excel and Google Sheets to join data across lists, look up prices, match names to IDs, and similar tasks. To use it, you need a table with the lookup value in the first column, a destination cell for the formula, and a basic understanding of the four arguments: lookup_value, table_array, col_index_num, and range_lookup.
What You'll Need
- A spreadsheet application such as Microsoft Excel or Google Sheets.
- A source table where the first column contains the values you want to look up (e.g., product codes, employee IDs). The table must be sorted or at least have the lookup column as the leftmost column.
- A cell where you want the result to appear.
- Familiarity with cell references (e.g., A2, B2:D10).
Step-by-Step
- Identify your lookup value. Decide what you are searching for. For example, if you have a list of product codes and want to find their prices, the product code is your lookup value. It can be a text string, a number, or a cell reference containing the value.
- Locate your source table. This is the range of cells that contains the data you want to search. The first column of this range must contain the lookup values. For instance, if your product codes are in column A and prices in column B, your table array might be A2:B100. Ensure the table is contiguous (no blank rows or columns in the middle) and that the lookup column is the leftmost column of the range.
- Determine the column index number. Count the columns in your table array from left to right, starting at 1 for the first column. The column index tells VLOOKUP which column to return a value from. In the example above, if you want the price from column B, the column index is 2 (since A is 1, B is 2). If your table array starts at column B and you want column D, the index would be 3 (B=1, C=2, D=3).
- Decide on exact or approximate match. The fourth argument, range_lookup, is either TRUE (approximate match) or FALSE (exact match). Use FALSE for most everyday lookups where you need an exact match (e.g., finding a specific product code). Use TRUE only for approximate matches, such as finding a tax rate based on income brackets, where the first column must be sorted in ascending order. If omitted, VLOOKUP defaults to TRUE, which can cause incorrect results if the data is not sorted.
- Write the formula. In your destination cell, type =VLOOKUP(lookup_value, table_array, col_index_num, range_lookup). For example, =VLOOKUP(A2, Sheet2!A2:B100, 2, FALSE) searches for the value in A2 within the first column of the range A2:B100 on Sheet2 and returns the corresponding value from the second column. Press Enter to execute.
- Copy the formula down. If you need to perform the lookup for multiple rows, drag the fill handle or copy and paste the formula. Use absolute references (e.g., $A$2:$B$100) for the table array to prevent it from shifting when copied. For example, =VLOOKUP(A2, $A$2:$B$100, 2, FALSE).
- Check the result. Verify that the returned value is correct. If you see an error like #N/A, it means the lookup value was not found in the first column of the table array. If you see #REF!, the column index number is greater than the number of columns in the table array.
Common Mistakes
- Using approximate match by default. Omitting the fourth argument or setting it to TRUE can return wrong results if the first column is not sorted ascending. Always use FALSE for exact matches.
- Incorrect column index. Counting columns from the worksheet instead of from the start of the table array leads to wrong values. Remember that the index is relative to the table array, not the entire sheet.
- Not locking the table array. When copying the formula, relative references shift, causing the table array to move and return incorrect data. Use absolute references (with $ signs) for the table array.
- Lookup column not leftmost. VLOOKUP cannot look to the left. The lookup value must be in the first column of the table array. If your data is structured differently, consider using INDEX/MATCH or XLOOKUP instead.
- Trailing spaces or inconsistent data types. Extra spaces or numbers stored as text can cause #N/A errors. Use TRIM or check cell formatting to ensure consistency.
Tips
- Use named ranges for your table array to make formulas easier to read and maintain.
- Combine VLOOKUP with IFERROR to display a friendly message instead of an error, e.g., =IFERROR(VLOOKUP(...), "Not found").
- For large datasets, VLOOKUP can be slow. Consider sorting the table or using XLOOKUP (available in newer Excel versions) for better performance.
- Test your formula with a known value to ensure it returns the expected result before applying it to many rows.
- Remember that VLOOKUP is case-insensitive. For case-sensitive lookups, use INDEX/MATCH with EXACT.
Troubleshooting
If VLOOKUP returns #N/A, the lookup value is not found in the first column of the table array. Check for typos, extra spaces, or data type mismatches (e.g., text vs. number). If it returns #REF!, the column index number exceeds the number of columns in the table array. If it returns #VALUE!, the column index number is not a number. If the result is incorrect, verify that the fourth argument is set to FALSE for exact match and that the table array is correct and locked. If the formula returns a value from the wrong row, ensure the first column of the table array is sorted correctly if using approximate match, or switch to exact match.
Frequently Asked Questions
What does VLOOKUP stand for?
VLOOKUP stands for Vertical Lookup. It searches for a value in the first column of a table and returns a value from a specified column in the same row.
Can VLOOKUP look to the left?
No, VLOOKUP only searches to the right of the lookup column. To look left, use INDEX/MATCH or XLOOKUP.
What is the difference between TRUE and FALSE in VLOOKUP?
TRUE (or omitted) performs an approximate match, requiring the first column to be sorted ascending. FALSE performs an exact match, which is more common and safer for most tasks.
Why do I get #N/A even though the value exists?
Common causes include trailing spaces, numbers stored as text, or the lookup value not being in the first column of the table array. Use TRIM and check data types.
Can I use VLOOKUP across different sheets or workbooks?
Yes, you can reference other sheets (e.g., Sheet2!A2:B100) or open workbooks (e.g., [Book1.xlsx]Sheet1!A2:B100). Ensure the workbook is open for external references to update.
Is VLOOKUP case-sensitive?
No, VLOOKUP is not case-sensitive. It treats "Apple" and "apple" as the same. For case-sensitive lookups, use INDEX/MATCH with the EXACT function.