Whenever you type “how to use VLOOKUP” in Google, you are faced with hundreds of blogs and pages trying to explain how to use VLOOKUP.
The issue is, these blogs just explain how to use the function in an ideal scenario, when lists are clean and tidy and you’re not faced with real life issues.
The Importance of VLOOKUP
However in reality, things are not that straight forward and if you’re reading this blog, I assume you have been faced with some challenges while using this function. Files on which we routinely work are usually massive. Not to mention filled with spelling mistakes, garbage values, blank spaces, incorrect formats and duplicate entries which can lead to incorrect values and bugs.
In this blog, we will troubleshoot the most common mistakes made while using VLOOKUP and provide some quick and easy solutions.
Instead if you want to know how to use VLOOKUP, click here.
Error #1 – There’s no match
The VLOOKUP functions work by matching the “Lookup_Value” with the first column of the “Table_Array”. This way you can perform a vertical lookup by searching for a value in the first column of the table and returning the value in the same row in the “index_number” position.
If you search for something and there’s no match, you will get the following error message:
However, sometimes the match you are looking for is there but the function is just failing to find it.
There are a couple of reasons why this may be happening…
- Watch out for non-printable characters such as spaces.
- There may be inconsistency in Cases of both the strings. e.g. One
- Check the formatting. For example, numbers formatted as texts. This can happen when you import data from a database.
- There may be special characters such as (- / : 😉 within the string – especially if you’re working with long codes.
So, before you dive in its recommended you take some steps to clean out your functions.
Use the Trim Function
This helps to remove unnecessary spaces between words in a string.
- Use Clean function to removes all nonprintable characters from a string
- Use Upper, Lower and Proper function to makes cases of both strings consistent.
- Clear the formats of the matching columns.
- Use find and replace function to clear all special characters (- / : 😉
If the error is still there…
- Ensure 1st column of your Table_Array contains the Lookup_Value
- Ensure you have locked your Table_Array (F4 key is used to lock it)
- Ensure your Table_Array is arranged in ascending order if you’re using approximate match (Range_Lookup = TRUE)
Error # 2 – Incorrect Values
One of the most difficult errors to detect is the one when your function works perfectly fine but continually returns incorrect values.
This error can occur when you have duplicates in the “Lookup_Value” column.
Function picks up a Lookup_Value, reiterate from the top of the first column of Table_Array, returns the value when it finds the first match and then jumps to next Lookup_Value. Hence, same value is returned for all the duplicates.
This brings us to a conclusion that our Lookup_Value column should have a unique identifier.
Here’s the Solution:
If you don’t have a unique identifier it is simple enough to create one.
If you “Lookup_Value” column comprises of just the first name than there is an increased chance of duplicate values. Not everyone has the same name but some people do!
Instead, combine the first name with the last name to create the full name.
Now you will have a much more unique identifier and at the same time reducing your chance of duplication!
Additionally, use below option to highlight all duplicates before you start working on your function
Home Tab > Styles Group > Conditional Formatting > Highlight Cell Rules > Duplicate Values
So, that either you can delete them, or combine them.