The VLOOKUP (Vertical Lookup) command in Excel allows you to search for a specific value in the first column of a data range and return a corresponding value from another column in the same row. It is primarily used to merge data from two different tables or to find a specific piece of information (like a price or an email address) based on a unique identifier (like a product ID or a name).
What You'll Need
- Microsoft Excel installed on your computer.
- A dataset organized in a table or range where the "lookup value" (the thing you are searching for) is located in the leftmost column of your data range.
- A clear understanding of which column contains the information you want to retrieve.
Step-by-Step
- Identify your Lookup Value: Determine the value you already know and want to use to find other information. For example, if you have a list of employee IDs and want to find an employee's department, the Employee ID is your lookup value. Click the cell where you want the result to appear.
- Start the Formula: Type
=VLOOKUP(into the cell. This tells Excel you are beginning a vertical lookup function. - Select the Lookup Value: Click on the cell that contains the value you are searching for (e.g., cell A2), or type the value in quotation marks if it is text. Follow this with a comma. Your formula should now look like
=VLOOKUP(A2,. - Define the Table Array: Highlight the range of cells that contains both the lookup value and the data you want to retrieve. Ensure the column containing the lookup value is the very first column in your selection. Follow this with a comma. For example,
=VLOOKUP(A2, D2:F100,. - Enter the Column Index Number: Count the columns in your selected range from left to right, starting with 1 for the leftmost column. Enter the number of the column that contains the data you want to return. If your range is D2:F100 and the data you want is in column F, the index number is 3. Follow this with a comma. Your formula should now look like
=VLOOKUP(A2, D2:F100, 3,. - Specify the Match Type: Decide if you need an exact match or an approximate match.
- Type
FALSE(or0) for an Exact Match. This is the most common choice; it ensures Excel only returns a result if it finds the exact value. - Type
TRUE(or1) for an Approximate Match. This is typically used for tax brackets or tiered commissions where values fall within a range.
- Type
- Close and Execute: Type the closing parenthesis
)and press Enter. Your formula should look like=VLOOKUP(A2, D2:F100, 3, FALSE).
Common Mistakes
- Lookup Value not in the First Column: VLOOKUP can only search the leftmost column of the selected range. If your unique identifier is in the middle of your table, the formula will return an error.
- Incorrect Column Index: Counting the columns based on the entire spreadsheet (e.g., Column G is 7) instead of counting based on the selected range (e.g., if the range starts at Column D, Column G is 4).
- Forgetting the FALSE Argument: If you omit the match type or set it to TRUE when you need an exact match, Excel may return the closest alphabetical or numerical match, which is often the wrong piece of data.
- Static Ranges when Dragging: If you copy the formula down a column, the table array range will shift down as well. To prevent this, use absolute references (dollar signs) for the range, such as
$D$2:$F$100.
Tips
- Use Named Ranges: Instead of highlighting
D2:F100, you can name that range "EmployeeData" in the Name Box. Your formula becomes=VLOOKUP(A2, EmployeeData, 3, FALSE), which is much easier to read. - Clean Your Data: Ensure there are no leading or trailing spaces in your lookup values or your table array. A cell containing "Apple " (with a space) will not match "Apple" (without a space).
- Combine with IFERROR: To avoid seeing
#N/Awhen a value isn't found, wrap your formula in an IFERROR function:=IFERROR(VLOOKUP(A2, D2:F100, 3, FALSE), "Not Found").
Troubleshooting
If your VLOOKUP is not returning the expected result, try these steps in order:
- Check for #N/A: This usually means the value does not exist in the first column of your range. Double-check for typos or hidden spaces in both the lookup value and the source table.
- Verify the Column Index: Re-count the columns in your selected range. Ensure you are counting from the start of the range, not the start of the sheet.
- Check Data Types: Ensure both the lookup value and the first column of the table are the same format. If one is formatted as "Text" and the other as "Number," VLOOKUP will not recognize them as a match.
- Lock Your Range: If the first cell works but the ones below it fail, check if you used absolute references (
$) for your table array. If not, the range is moving as you drag the formula.
Frequently Asked Questions
Can VLOOKUP look to the left?
No, VLOOKUP can only search the leftmost column and retrieve data to the right. To look to the left, you must use the INDEX and MATCH functions together or the newer XLOOKUP function.
What is the difference between TRUE and FALSE in VLOOKUP?
FALSE finds an exact match; if the value isn't found, it returns an error. TRUE finds the closest match that is less than or equal to the lookup value, which requires the first column to be sorted in ascending order.
Does VLOOKUP work across different sheets?
Yes. When selecting your Table Array, you can click on a different worksheet tab. Excel will automatically add the sheet name to the formula (e.g., 'Sheet2'!D2:F100).
What happens if there are duplicate values in the first column?
VLOOKUP will always return the first match it encounters. It cannot return multiple results or the last occurrence of a value.
Is XLOOKUP better than VLOOKUP?
XLOOKUP is a more powerful successor available in newer versions of Excel. It can look both left and right, defaults to an exact match, and does not require a column index number.