Description
Use this function to search for a value in the first column of a table range and return a value in the same row from another specified column. Supported in Chains.
VLOOKUP is useful for finding information in large datasets, such as looking up prices in a product catalog or finding employee details in a database.
Syntax
VLOOKUP(lookup_value, table_array, col_index_num, [range_lookup])
Inputs
This function accepts the following arguments:
| Name | Required | Description | Valid input |
|---|---|---|---|
lookup_value |
Yes | The value to search for in the first column of the table array. | A cell reference, a cell range, a number, a text string, or a formula which results in any of these. |
table_array |
Yes | The table of information in which data is looked up. | A cell range. |
col_index_num |
Yes | The column number in table_array from which the matching value should be returned. |
A positive integer, a cell reference containing a positive integer, or a formula which results in either of these. 1 = the first column in table_array. |
range_lookup |
No | Specifies whether you want VLOOKUP to find an exact match or an approximate match. | TRUE (default) for approximate match, FALSE for exact match. |
Example
Sample data
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Product ID | Product Name | Category | Price |
| 2 | 1001 | Widget A | Gadgets | $10.99 |
| 3 | 1002 | Widget B | Gadgets | $15.99 |
| 4 | 1003 | Gizmo X | Electronics | $25.50 |
| 5 | 1004 | Gizmo Y | Electronics | $30.00 |
| 6 | 1005 | Gizmo Z | Electronics | $37.50 |
Sample formulas
| Use case | Formula | Explanation and Result |
|---|---|---|
| Look up a product ID to find its corresponding product name with an exact match. | =VLOOKUP(1002, A2:D6, 2, FALSE) |
This formula works in the following manner:
For this data set, the formula returns Widget B. |
| Look up a product ID to find its corresponding price with an exact match. | =VLOOKUP(1003, A2:D6, 4, FALSE) |
This formula works in the following manner:
For this data set, the formula returns $25.50. |
| Look up a product name to find its corresponding category with an exact match. | =VLOOKUP("Gizmo X", B2:D6, 2, FALSE) |
This formula works in the following manner:
For this data set, the formula returns Electronics. |
| Look up an approximate value and return the value from the corresponding row. | =VLOOKUP(1006, A2:D6, 2, TRUE) |
This formula works in the following manner:
For this data set, the formula returns Gizmo Z. |
Look up a product ID with the range_lookup argument omitted, which defaults to an approximate match. |
=VLOOKUP(1002, A2:D6, 2) |
This formula works in the following manner:
For this data set, the formula returns Widget B. |
Notes
- The lookup value must be in the first column of the
table_arrayfor VLOOKUP to work correctly. - If
range_lookupis TRUE or omitted, the first column oftable_arraymust be sorted in ascending order. - If
range_lookupis FALSE and the lookup_value is not found, VLOOKUP returns #N/A error. - VLOOKUP is not case-sensitive when comparing text values.
- For better performance with large datasets, consider using INDEX and MATCH functions instead of VLOOKUP.
Tips
- Use FALSE for
range_lookupwhen you need an exact match, especially with unsorted data or text values. - Combine VLOOKUP with other functions such as IFERROR to handle cases where the lookup value is not found.
- For reverse lookups or when your lookup column is not the leftmost, consider using INDEX and MATCH instead.
- When working with large datasets, using VLOOKUP with
range_lookupset to TRUE can improve performance if your data is sorted. - Remember that VLOOKUP can only return values from columns to the right of the lookup column in the
table_array.