.)
This table is in the range A1:D4. You want to find the salary of employee with ID 102.
Excel
=VLOOKUP(102, A1:D4, 4, FALSE)
- 102: The Employee ID (your lookup_value).
- A1:D4: The table containing the employee data (your table_array).
- 4: The fourth column of the table contains the Salary (your col_index_num).
- FALSE: You want an exact match for the Employee ID.
How it Works:
- VLOOKUP looks in the first column of A1:D4 (the Employee IDs) for the value 102.
- If it finds an exact match, it goes across to the fourth column (because col_index_num is 4) in the same row where it found the match.
- It returns the value in that cell (the Salary, $60,000).
Key Rules (Recap):
- Lookup value in the first column: The value you're searching for must be in the first column of the table_array.
- Sorted for approximate match: If you use TRUE or omit range_lookup, the first column must be sorted in ascending order.
- Exact or approximate match: Use FALSE for exact matches (recommended) and TRUE for approximate matches.
- Column index number: Specify the correct column number to retrieve the desired value.
VLOOKUP vs. HLOOKUP:
- VLOOKUP: Searches vertically in the first column.
- HLOOKUP: Searches horizontally in the first row.
Use VLOOKUP when your lookup values are in the first column, and HLOOKUP when they are in the first row. In most cases, VLOOKUP is more commonly used because data is often structured in columns.