VLOOKUP to Compare Two Columns in Excel & Find Matches
When it comes to comparing one thing with another in excel lookup functions are the kings and VLOOKUP is the household formula for all excel users. Not many of us use VLOOKUP to the full extent, yes I say full extent because there is a lot more beyond traditional VLOOKUP and we can do many other things with VLOOKUP. So in this article, we will show you ways of comparing two columns of data in excel using the VLOOKUP function in excel.
Compare Two Columns in Excel Using Vlookup (Find Matches)
VLOOKUP is the lookup function used to fetch the data often times but not many of us use it as the data of a comparing column.
- When the two columns data is lined up like the below we will use VLOOKUP to see whether column 1 includes column 2 or not.
- We need to match whether “List A” contains all the “List B” values or not, this can be done by using the VLOOKUP function. Open the VLOOKUP function first.
- Out lookup value will be C2 cell value because we are comparing “List A” contains all the “List B” values or not, so choose C2 cell reference.
- Table array will be “List A” cell values, so select the range of cells from A2 to A9 and make it as absolute cell reference.
- Next up is “Col Index Num” i.e. from the selected table array from which column we need the result. Since we have selected only one column our “Col Index Num” will be 1.
- Range Lookup is we are looking for an exact match, so choose FALSE as the argument or you can enter 0 as the argument value.
- Ok, we are done with the formula, close the bracket and hit enter key to get the result.
So, wherever we have got “#N/A” that means those values do not exist in the “List A” column.
4.9 (1,353 ratings) 35+ Courses | 120+ Hours | Full Lifetime Access | Certificate of Completion
But look at the row number 7 value in “List B” is “Mind Tree” but in “List A” the same company name is written in full word as “Mind Tree Software Co.,” (cell A6). So in such cases, VLOOKUP cannot do anything.
Partial Lookup Using Wildcard Characters
As we have seen above VLOOKUP requires lookup value to be exactly the same in both “List A” and “List B”. Even there is any extra space or character it cannot match the result. But the same VLOOKUP formula can match two columns data if we provide wildcard characters for the lookup value.
So, that wildcard character is an asterisk (*), while providing lookup value before and after the lookup value we need to concatenate this wildcard character.
As you can see above I have concatenated lookup value with special wildcard character asterisk (*) before and after the lookup value using the ampersand (&) symbol.
Now complete the formula by following already shown steps.
Now, look at the results, in the previous example we have got errors in rows 2 & 7 but this time we have got a result.
- You must be wondering how this is possible?
- This is mainly because of the wildcard character asterisk (*). This wildcard matches any number of characters for the provided value. For example, look at the value is C3 cell it says “CCD” and in cell A5 we have the full company name as “Coffeeday Global Ltd (CCD)”. Because in the table array we have the word “CCD”, wildcard matched this short form company name word with the entire company name in “List B”.
- Similarly in cell C7 we have the company name “Mind Tree” but in “List A” (A6 cell) we have full company name as “Mind Tree Software Co,”, so there are extra characters in “List A”. Since we have provided wildcard character it has matched remaining portion of word and return the full result.
- Note: This wildcard method is not the recommended method because it can go wrong at any time. So unless you are sure about the data you have, do not use this and rely on it.
Things to Remember
- VLOOKUP can match only if the lookup is exactly the same as in the table array.
- Wildcard character asterisk can match any number of characters if the same string of words available with table array.
- VLOOKUP not necessarily require all the cell values to be neatly sorted and organized alphabetically.
This has been a guide to Compare Two Columns in Excel using Vlookup. Here we discuss how to compare two columns and find matches in excel using VLOOKUP and wildcard characters along with examples and downloadable excel template. You may also look at these useful functions in excel –