Search for a value in the first column of a table and return a corresponding value from a specified column towards the right.
Scenario | Formula | Result |
---|---|---|
Find the name of Employee ID 102 | =VLOOKUP(102, A2:C5, 2, FALSE) | Sara |
Find the salary of Employee ID 103 | =VLOOKUP(103, A2:C5, 3, FALSE) | 55,000 |
Find the salary of ID 105 (not in the table, will return error) | =VLOOKUP(105, A2:C5, 3, FALSE) | #N/A |
How to avoid error example - when value is not found | =IFERROR(VLOOKUP(105, A2:C5, 3, FALSE), "Not Found") | Not Found |
Find the salary of the closest ID (Approximate Match) | =VLOOKUP(103.5, A2:C5, 3, TRUE) | 55,000 |
Find the highest salary using MAX with VLOOKUP | =MAX(VLOOKUP(A2:A5, A2:C5, 3, FALSE)) | 60,000 |
Find the salary dynamically based on an ID entered in E1 | =VLOOKUP(E1, A2:C5, 3, FALSE) | If E1 = 102, Result: 60,000 |