The simplest VLOOKUP formula sample is =VLOOKUP(A2, C:D, 2, FALSE), which finds the value in A2 within column C and returns the matching value from column D. This article explains the syntax, gives a full worked example, covers common errors, and shows when to use XLOOKUP instead.
What Is VLOOKUP?
VLOOKUP (Vertical Lookup) is an Excel function that searches for a value in the first column of a table and returns a value in the same row from a column you specify. It has been a staple of Excel for decades because it lets you pull related data from another part of your spreadsheet without manually copying and pasting.
The function works only with vertical tables—data arranged in columns. If your data is arranged horizontally (in rows), you need HLOOKUP. VLOOKUP is case-insensitive, meaning it treats “apple” and “APPLE” as the same.
VLOOKUP Syntax and Arguments
The full syntax is:
=VLOOKUP(lookup_value, table_array, col_index_num, [range_lookup])
- lookup_value (required): the value you want to find. It must be in the first column of the table_array.
- table_array (required): the range of cells that contains the data. The first column is where the lookup happens.
- col_index_num (required): the column number in the table_array from which to return a value. Column 1 is the first column, column 2 is the second, and so on.
- range_lookup (optional): TRUE for approximate match (default) or FALSE for exact match. For most real-world lookups, use FALSE.
VLOOKUP Formula Sample with a Worked Example
Assume you have a product list in columns A and B:
- A1: Product ID, B1: Price
- A2: P100, B2: 15.00
- A3: P200, B3: 22.50
- A4: P300, B4: 30.00
Now in cell D2 you type a product ID (e.g., “P200”), and in E2 you want the price. The formula in E2 would be:
=VLOOKUP(D2, A:B, 2, FALSE)
This searches for “P200” in column A, finds it in row 3, and returns the value from column B in that row, which is 22.50. The result is 22.50.
If you change D2 to “P300”, the formula returns 30.00. If you enter a product ID that does not exist, the formula returns #N/A.
How to Choose Between Exact and Approximate Match
The fourth argument, range_lookup, decides whether VLOOKUP looks for an exact match or the closest match.
- FALSE (exact match): use when you need to find a specific value, such as an employee ID, product code, or name. If no exact match exists, VLOOKUP returns #N/A.
- TRUE (approximate match): use when you need to find a value in a range, such as a tax bracket or discount tier. The first column must be sorted in ascending order, otherwise results are unpredictable.
Example of approximate match: if you have a tax rate table with income thresholds in column A (0, 10000, 20000) and rates in column B (10%, 15%, 20%), and you want the rate for an income of 15000, you would use =VLOOKUP(15000, A:B, 2, TRUE). Because 15000 is between 10000 and 20000, VLOOKUP returns the rate for 10000, which is 15%.
Common VLOOKUP Errors and How to Fix Them
Several errors are common when using VLOOKUP. Here are the most frequent ones and their solutions.
- #N/A: The lookup value is not found. Check for typos, extra spaces, or that the lookup value exists in the first column. Use TRIM to remove spaces.
- #REF!: The col_index_num is greater than the number of columns in the table_array. For example, if your table is A:B and you ask for column 3, you get #REF!.
- #VALUE!: The col_index_num is less than 1 or the lookup_value is not a valid type. Ensure col_index_num is a positive integer.
- Incorrect results with TRUE: If you use TRUE, the first column must be sorted ascending. If not, you get wrong matches. Use FALSE unless you are sure about sorting.
To avoid #N/A when a value might be missing, you can wrap VLOOKUP in IFERROR: =IFERROR(VLOOKUP(D2, A:B, 2, FALSE), "Not found").
VLOOKUP vs. XLOOKUP: Which Should You Use?
XLOOKUP is a modern replacement for VLOOKUP, introduced in Excel 2021 and Microsoft 365. It fixes several VLOOKUP limitations:
- Lookup column can be anywhere: VLOOKUP requires the lookup value to be in the first column; XLOOKUP lets you specify the lookup range separately.
- Return column can be to the left: VLOOKUP can only return columns to the right; XLOOKUP can return any column.
- No column index number: You specify the return range directly, so inserting a column won’t break the formula.
- Built-in error handling: XLOOKUP has an optional ‘if_not_found’ argument.
Example: =XLOOKUP(D2, A:A, B:B, "Not found") does the same as the VLOOKUP example but is more robust. If you have Excel 2021 or Microsoft 365, prefer XLOOKUP. For older versions, VLOOKUP is still necessary.
Tips for Using VLOOKUP Effectively
- Use absolute references for the table_array (e.g., $A$2:$B$10) so you can copy the formula down without changing the range.
- Sort the first column ascending if you use TRUE for approximate match.
- Use exact match (FALSE) for most lookups to avoid surprises.
- If your lookup value is a number stored as text, convert both to the same type using VALUE or TEXT.
- For large datasets, VLOOKUP can be slow; consider using INDEX/MATCH or XLOOKUP for better performance.
Frequently Asked Questions
Can VLOOKUP look to the left?
No, VLOOKUP can only return values from columns to the right of the lookup column. If you need to return a value from a column to the left, use INDEX/MATCH or XLOOKUP.
Why does VLOOKUP return #N/A when the value exists?
This usually happens because the lookup value has extra spaces, is formatted as text instead of number, or the table_array’s first column is not exactly matching. Use TRIM to remove spaces and ensure data types match.
How do I use VLOOKUP with multiple criteria?
VLOOKUP cannot handle multiple criteria directly. You can create a helper column that concatenates the criteria (e.g., =A2&B2) and then look up that combined value. Alternatively, use INDEX/MATCH with array formulas or XLOOKUP with concatenation.
Is VLOOKUP case-sensitive?
No, VLOOKUP is not case-sensitive. It treats “ABC” and “abc” as the same. If you need case-sensitive matching, use INDEX/MATCH with EXACT or XLOOKUP with the match_mode argument set to 0 (exact match) but that still is not case-sensitive; you would need a workaround.
What is the difference between VLOOKUP and HLOOKUP?
VLOOKUP searches vertically down the first column, while HLOOKUP searches horizontally across the first row. Use HLOOKUP when your data is arranged in rows instead of columns.
Related
- Albuquerque Traffic Light Cameras: How They Work
- Fed Funds Balance Sheet: What It Is & How It Works
- Number 4 Helium Balloon: Size, Lift, and Uses Explained
Try it: the Formula Explainer: paste any formula and see each function and reference in plain English.
More in Formulas & functions
- Power Query Sort: How to Sort and Keep Rows in OrderTo sort data in Power Query in Excel for Microsoft 365 on Windows, open the query, select the…
- Excel LEN, FIND, LEFT & RIGHT: Text Extraction FormulasTo split text in Excel, combine LEN and FIND with LEFT or RIGHT: use =LEFT(A2,FIND(" ",A2)-1) to return…
- Array Formula in Excel: How It WorksAn array formula in Excel works with multiple values at once and can return either one result or…
- Trim Ends in Excel: Remove Extra SpacesTo trim spaces in Excel, enter =TRIM(A2) in another cell, replacing A2 with the cell containing your text.…
- IF Statements for Dates in Excel: Examples and RulesTo write an IF statement for dates in Excel, compare a cell containing a real date with a…
- Sort Dates in Excel by Month and DayTo sort Excel dates by month and day while ignoring the year, add a helper column that converts…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.