How To

How To Use Vlookup

×

How To Use Vlookup

Share this article

How To Use Vlookup

How to Use VLOOKUP in Standard American English

VLOOKUP is a powerful function in Microsoft Excel that allows you to look up data in a table and return a corresponding value. It is often used to extract specific information from a large dataset, such as finding the price of a product based on its name or the name of a customer based on their account number.

The VLOOKUP function has the following syntax:

=VLOOKUP(lookup_value, table_array, col_index_num, [range_lookup])

Where:

  • lookup_value is the value you are looking up in the table.
  • table_array is the range of cells that contains the table data.
  • col_index_num is the column number in the table that contains the value you want to return.
  • range_lookup is an optional argument that specifies whether you want to perform an exact match or an approximate match.

How to Use VLOOKUP

To use VLOOKUP, follow these steps:

  1. Select the cell where you want to display the result of the VLOOKUP function.
  2. Type the following formula into the cell:
=VLOOKUP(lookup_value, table_array, col_index_num, [range_lookup])
  1. Replace lookup_value with the value you are looking up in the table.
  2. Replace table_array with the range of cells that contains the table data.
  3. Replace col_index_num with the column number in the table that contains the value you want to return.
  4. Replace range_lookup with the optional argument that specifies whether you want to perform an exact match or an approximate match.

Example

Let’s say you have a table of products with the following columns:

  • Product Name
  • Product Code
  • Price

You want to find the price of a product with the product code "A123". To do this, you can use the following VLOOKUP function:

=VLOOKUP("A123", A1:C10, 3, 0)

Where:

  • A1:C10 is the range of cells that contains the table data.
  • 3 is the column number in the table that contains the price.
  • 0 specifies that we want to perform an exact match.

The VLOOKUP function will return the price of the product with the product code "A123".

Using VLOOKUP with Approximate Matches

By default, VLOOKUP performs an exact match. This means that the lookup value must exactly match the value in the table in order for the function to return a result. If you want to perform an approximate match, you can use the range_lookup argument.

The range_lookup argument can take the following values:

  • 0 – Exact match
  • 1 – Approximate match (binary search)
  • 2 – Approximate match (linear search)

If you use range_lookup = 1, VLOOKUP will perform an approximate match using a binary search. This means that the function will search the table for the lookup value and return the closest match.

If you use range_lookup = 2, VLOOKUP will perform an approximate match using a linear search. This means that the function will search the table for the lookup value starting from the first row and continuing until it finds a match.

Troubleshooting VLOOKUP

If you are having trouble using VLOOKUP, check the following:

  • Make sure that the lookup value is in the same format as the values in the table.
  • Make sure that the table array is correctly specified.
  • Make sure that the col_index_num is correct.
  • Make sure that the range_lookup argument is correct.

FAQ

Q: What is the difference between an exact match and an approximate match?

A: An exact match requires that the lookup value exactly match the value in the table. An approximate match allows the lookup value to be close to the value in the table.

Q: Which range_lookup value should I use?

A: If you know that the lookup value will always exactly match a value in the table, use range_lookup = 0. If you are not sure if the lookup value will exactly match a value in the table, use range_lookup = 1.

Q: What do I do if I get an error when I use VLOOKUP?

A: Check the following:

  • Make sure that the lookup value is in the same format as the values in the table.
  • Make sure that the table array is correctly specified.
  • Make sure that the col_index_num is correct.
  • Make sure that the range_lookup argument is correct.

If you are still getting an error, try using the LOOKUP function instead.

Q: Can I use VLOOKUP to look up data in a different workbook?

A: Yes, you can use VLOOKUP to look up data in a different workbook. To do this, you need to use the following syntax:

=VLOOKUP(lookup_value, '[workbook name]'!table_array, col_index_num, [range_lookup])

Where:

  • [workbook name] is the name of the workbook that contains the table data.
  • table_array is the range of cells that contains the table data.
  • col_index_num is the column number in the table that contains the value you want to return.
  • range_lookup is an optional argument that specifies whether you want to perform an exact match or an approximate match.