This post may contain affiliate links. Please read my disclosure for more info.
Advertisement:

How to use VLOOKUP

vlookup formula

how to use vlookup

VLOOKUP is one of the most powerful functions in Excel.  It allows you to look up a value from a table based on a search term.  A simple example would be a where you had a long list of employees and their telephone numbers.  You could use VLOOKUP to find the telephone number of any employee based on their name.

Being able to use VLOOKUP correctly is an Excel ability benchmark.  It is used in job interviews all over the world to understand a person’s skills with Excel.  Personally, I think it is because VLOOKUP is probably the most advanced function the interviewer knows!  It is certainly not the most advanced function, but you need to know it if you want to use Excel to any reasonable standard.  The purpose of this post is to teach you how to use VLOOKUP.

 

How to use VLOOKUP

To really understand VLOOKUP it would be beneficial to use an example.  Look at the table below.

How to use vlookup


Advertisement:

If we wanted to find the Telephone number for ‘O Reading’ in real life we would look down column A until we found the name, then we would move across to column C (the 3rd column) to find the Telephone number.

VLOOKUP does exactly the same thing as we would do in real life.

The Syntax of the function is:

=VLOOKUP(lookup_value, table_array, col_index_num, range_lookup)
  • lookup_value – the value to lookup in the first column (“O Reading” in our example)
  • table_array – the range of cells which contains the data (A2 – C9 in our example)
  • col_index_num – the column in the table from which to retrieve the value (3 in our example, as it is the 3rd column of the table_array.  If we wanted to retrieve the Department we would use 2, as Department is the 2nd column of the table_array).
  • range_lookup – This value is optional.  The value can only be ‘TRUE’ or ‘FALSE’.  ‘FALSE’ tells the VLOOKUP function to find an exact match, ‘TRUE’ tells the VLOOKUP function to find the nearest value that is still less than the lookup_value.   Where the value is omitted the function will default to ‘TRUE’.  Until you understand how to use this correctly, it is best to use FALSE.

In our example, our formula would be:

=VLOOKUP("O Reading",A2:C9,3,FALSE)

This would return a value of 555-2312

It is possible to include any of the arguments as cell references.


Advertisement:

  • Cell F2 = “O Reading”
  • Cell F3 = 3 (the column number)

Based on the cell references above, our syntax could be amended:

=VLOOKUP(F2,A2:C9,F3,FALSE)

If you wanted to copy the function to other cells remember to include a $ symbol in front of the row/column references to ‘freeze’ the cell references on the correct cells.

 

A few things to be aware of

  • VLOOKUP can only look up in the leftmost column of the data (i.e. the first column included in the table_array)
  • Where there are multiple instances of the lookup_value in the table_array, only the value associated with the first instance will be returned.
  • VLOOKUP only works when the data is organized as a vertical list.  If you require a lookup based on a horizontal list use the HLOOKUP function.
  • Only set the range_lookup to ‘TRUE’ when the first column of the table_array is sorted.  When using ‘FALSE’ the first column of the table_array does not need to be sorted.
  • Where numbers are stored as text a lookup_value may not be found, even though it appears it should.  To Excel, numbers and text are different and therefore will not match.

 

Common errors


Advertisement:

As you learn how to use VLOOKUP you will come across a number of common error messages.

  • #N/A – Where the range_lookup argument is FALSE this indicates the lookup_value has not been found.  Or, where the range_lookup argument is TRUE it means the lookup_value is smaller than smallest value in the table.
  • #REF – This occurs where the col_index_num is bigger than the number of columns in the table_array.
  • #VALUE – This may occur where: (a) the col_index_num is not a whole number (b) the col_index_num is less than or equal to 0, or (c) the lookup_value has more than 255 characters.

 

Download the Advanced VLOOKUP Cheat Sheet

The Advanced VLOOKUP Cheat Sheet includes most of the tips and tricks covered in the Mastering VLOOKUP Series. Download it and pin it up at work; you can even forward it onto your friends and co-workers.

Advanced VLOOKUP Cheat Sheet

 

Click here to download the Cheat Sheet

 

Other posts in the Mastering VLOOKUP Series