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 functionLookup FunctionThe LOOKUP excel function searches a value in a range (single row or column). It returns a corresponding match from the exact position of another range. The corresponding match is a piece of information associated with the value being searched. used to fetch the data often times but not many of us use it as the data of a comparing column.
Steps to compare two columns in excel using Vlookup are as follows.
- 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 the C2 cell value because we are comparing “List A” contains all the “List B” values or not, so choose C2 cell referenceCell ReferenceCell reference in excel is referring the other cells to a cell to use its values or properties. For instance, if we have data in cell A2 and want to use that in cell A1, use =A2 in cell A1, and this will copy the A2 value in A1..
- The table array will be “List A” cell values, so select the range of cells from A2 to A9 and make it as absolute cell referenceAbsolute Cell ReferenceAbsolute reference in excel is a type of cell reference in which the cells being referred to do not change, as they did in relative reference. By pressing f4, we can create a formula for absolute referencing..
- 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 the 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.
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 of 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 the 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 the remaining portion of a 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 if only 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 does 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 a downloadable excel template. You may also look at these useful functions in excel –