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.
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:
This would return a value of 555-2312
It is possible to include any of the arguments as cell references.
- Cell F2 = “O Reading”
- Cell F3 = 3 (the column number)
Based on the cell references above, our syntax could be amended:
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.
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
Download the Advanced VLOOKUP Cheat Sheet. It includes most of the tips and tricks we’ve covered in this series, including faster calculations, multiple criteria, left lookup and much more.
Please download it and pin it up at work, you can even forward it onto your friends and co-workers.
Download the cheat sheet
Download the file: Advanced VLOOKUP Cheat Sheet
Other posts in the Mastering VLOOKUP Series
- How to use VLOOKUP
- VLOOKUP: What does the True/False statement do?
- VLOOKUP: How to calculate faster
- How to VLOOKUP to the left
- VLOOKUP: Change the column number automatically
- VLOOKUP with multiple criteria
- Using wildcards with VLOOKUP
- How to use VLOOKUP with columns and rows
- Automatically expand the VLOOKUP data range
- VLOOKUP: Lookup the nth item (without helper columns)
- VLOOKUP: List all the matching items
- Advanced VLOOKUP Cheat Sheet
Get our FREE VBA eBook of the 30 most useful Excel VBA macros.
Automate Excel so that you can save time and stop doing the jobs a trained monkey could do.
If you’ve found this post useful, or if you have a better approach, then please leave a comment below.
Do you need help adapting this to your needs?
I’m guessing the examples in this post didn’t exactly meet your situation. We all use Excel differently, so it’s impossible to write a post that will meet everybody’s needs. By taking the time to understand the techniques and principles in this post (and elsewhere on this site) you should be able to adapt it to your needs.
But, if you’re still struggling you should:
- Read other blogs, or watch YouTube videos on the same topic. You will benefit much more by discovering your own solutions.
- Ask the ‘Excel Ninja’ in your office. It’s amazing what things other people know.
- Ask a question in a forum like Mr Excel, or the Microsoft Answers Community. Remember, the people on these forums are generally giving their time for free. So take care to craft your question, make sure it’s clear and concise. List all the things you’ve tried, and provide screenshots, code segments and example workbooks.
- Use Excel Rescue, who are my consultancy partner. They help by providing solutions to smaller Excel problems.
Don’t go yet, there is plenty more to learn on Excel Off The Grid. Check out the latest posts: