VLOOKUP to Compare Two Lists in Excel
In this article
To compare two lists in Excel, use VLOOKUP to check whether each item in the first list appears in the second. If the first list is in A2:A100 and the comparison list is in D2:D100, enter =IF(ISNA(VLOOKUP(A2,$D$2:$D$100,1,FALSE)),"Missing","Found") in B2, then fill it down. “Found” means Excel located an exact match; “Missing” means it did not.
What VLOOKUP Does When Comparing Lists
VLOOKUP searches for a value in the leftmost column of a selected range and returns a value from a column to its right. For a list comparison, the lookup range can be just the second list, and the return column can be that same first column. The formula is being used to test membership: does this value occur in the other list?
The final argument, FALSE, requests an exact match. This matters because approximate matching can return a result for a nearby value rather than the same item. The dollar signs in $D$2:$D$100 keep the comparison range fixed when you copy the formula down. The reference to A2 remains relative, so it changes to A3, A4, and so on.
In the example, the formula returns “Missing” when VLOOKUP produces an #N/A error, and “Found” otherwise. This is useful when you want a readable status column rather than a sheet full of lookup errors. It checks each row in the first list independently; it does not remove duplicates or determine how many times an item occurs.
Compare the Lists Step by Step
- Put the first list in column A and the list you want to check against in column D. Include a header row if useful, but exclude headers from the formula’s ranges.
- In B1, add a label such as “Status.” In B2, enter the formula shown above, adjusted for your actual columns and last row.
- Press Enter. If A2 is present in D2:D100, B2 should show “Found”; if not, it should show “Missing.”
- Copy the formula down alongside every item in the first list. You can use the fill handle at the lower-right corner of the selected cell, or copy and paste into the remaining rows.
- Filter the status column to show only “Missing” when you need items from the first list that are absent from the second.
For example, suppose A2:A4 contains “North,” “South,” and “West,” while D2:D3 contains “North” and “West.” The results are “Found,” “Missing,” and “Found.” The comparison is directional: it tells you which entries in column A appear in column D. To find entries in D that are absent from A, make a second check with the lists reversed.
Return a Match or a Custom Message
If you prefer a shorter formula and are comfortable seeing an error for a missing item, use VLOOKUP directly. With the same layout—items in A2:A100 and the lookup list in D2:D100—enter =VLOOKUP(A2,$D$2:$D$100,1,FALSE) in B2 and fill down. A match returns the matching item; a missing value returns #N/A. Since the returned item is the same as the one being searched for, this version is most useful when you want to confirm matches or use the result in another calculation.
For a clearer output, Excel’s IFNA function can replace #N/A with a message. With the same cell layout, enter =IFNA(VLOOKUP(A2,$D$2:$D$100,1,FALSE),"Not in second list") in B2. A match returns the item; no match returns “Not in second list.” IFNA handles the not-found error specifically, while IFERROR catches other formula errors too. Using IFNA can make troubleshooting easier because it does not hide unrelated problems in the formula.
These formulas are suitable for Excel for Microsoft 365 on Windows. The same formula syntax works in current Excel for Mac and Excel for the web; interface details for selecting and filling cells can vary. If your Excel installation uses semicolons as formula separators because of regional settings, replace the commas with semicolons.
Check for Duplicates and Count Occurrences
A VLOOKUP comparison answers whether at least one exact match exists. If the same value appears five times in the second list, it still returns “Found” just as it would for one occurrence. Similarly, repeating a value in the first list produces a separate status for each row.
To count how often each value from the first list occurs in the second, use COUNTIF instead. With the same lists in A2:A100 and D2:D100, enter =COUNTIF($D$2:$D$100,A2) in B2 and fill down. It returns 0 if the value does not occur, 1 if it occurs once, or a larger number if it is duplicated. You can then identify duplicate entries by filtering for counts above 1.
Do not assume that two lists contain the same number of unique entries just because every row in one direction is marked “Found.” Check in both directions, and consider duplicates separately if the number of occurrences matters. For example, one list might contain “North” twice while the other contains it once: all membership checks can still show “Found,” even though the lists are not identical as collections.
Common Problems That Cause False “Missing” Results
- Extra spaces: “North” and “North ” may not behave as the same text. Clean imported data with TRIM in a helper column, then compare the cleaned values. TRIM removes ordinary leading and trailing spaces and reduces repeated internal spaces.
- Different data types: A number stored as text, such as “0123,” can differ from the numeric value 123. Decide whether leading zeros are meaningful identifiers. If they are, keep both lists as text rather than converting them to numbers.
- Inconsistent spelling or punctuation: VLOOKUP does not know that “Co.” and “Company” refer to the same organization. Standardize names, abbreviations, punctuation, and capitalization before comparing.
- Wrong lookup range: VLOOKUP searches only the first column of its table range. If the values to find are not in the leftmost column of the selected range, change the range so they are, or use a different lookup method.
- Range stops too soon: If new items extend below D100, they will not be checked. Expand the range or convert the data to an Excel table so formulas can refer to a growing list more reliably.
VLOOKUP matching is not case-sensitive, so it will not distinguish “abc” from “ABC.” Also, exact matching does not mean approximate or partial matching: a lookup for “North” does not match “North Region.” If partial or normalized matching is required, first define how the data should be cleaned or what counts as equivalent; otherwise, a formula can give a technically correct but misleading result.
VLOOKUP Compared with Other Excel Options
VLOOKUP is familiar and works well for a straightforward existence check, but it is not the only choice. COUNTIF is often clearer when you want a count rather than a returned value. XLOOKUP can also check for a match and lets you specify a custom not-found result without wrapping the formula in IFNA. For instance, with items in A2:A100 and D2:D100, =XLOOKUP(A2,$D$2:$D$100,$D$2:$D$100,"Missing",0) returns the matched item or “Missing”; the final 0 requests exact matching. XLOOKUP is available in Microsoft 365 and Excel 2021 or later.
For a one-time visual comparison, conditional formatting may be enough. Select the first list, then use Home > Conditional Formatting > Highlight Cells Rules > Duplicate Values only when comparing duplicates within the selected range; that rule alone does not compare two separate lists. To compare against another range, use a formula-based conditional formatting rule, taking care that the formula and selected range start on the intended row. A helper column is often easier to audit because it displays a text result for each record.
Choose the method based on the question: VLOOKUP or XLOOKUP for a match result, COUNTIF for occurrence counts, and conditional formatting for a quick visual scan. For repeatable workbooks, clear labels, fixed or table-based ranges, and a documented definition of what counts as a match are as important as the formula itself.
Frequently Asked Questions
Can VLOOKUP compare two lists in either direction?
Yes, but each formula checks one direction: values in its lookup column against the selected comparison range. Run the check again with the lists swapped to find values that appear only in the other list.
Why does VLOOKUP return #N/A when the value looks identical?
Common causes include trailing spaces, hidden characters, text-versus-number differences, and values outside the selected range. Check the underlying values and data types, and confirm that the lookup value is in the range’s leftmost column.
Does VLOOKUP distinguish uppercase and lowercase?
No. VLOOKUP is case-insensitive, so values that differ only by letter case count as matches. A case-sensitive comparison requires a different approach.
How do I find items in one list but not the other?
Use the status formula and filter for “Missing.” To find items missing in the opposite direction, reverse the lookup and comparison lists, then filter for missing results again.
Can VLOOKUP tell me whether a value is duplicated?
It can tell you whether at least one match exists, but not how many times it occurs. Use COUNTIF to count occurrences, then flag counts greater than 1 if you need to locate duplicates.