How to Compare Two Lists in Excel (Find Matches and Differences)
Comparing two lists is one of the most common jobs in Excel: reconciling stock against sales, checking which customers from last year bought again, or finding which email addresses are missing from a mailing list. Checking row by row by eye is slow and error-prone – Excel has better tools for each kind of comparison.
This guide shows nine methods, from a two-click highlight to formulas that extract every match into a new list. All examples assume List A is in A2:A100 and List B is in B2:B100, with headers in row 1. Adjust the ranges to your data.
Need the answer once and fast? Paste both columns into the free Compare Two Lists tool – it shows items only in A, only in B and in both, without any formulas.
1. Highlight duplicates with conditional formatting (fastest)
Use this for a quick visual check of which values appear in both lists.
- Select both columns, for example A2:B100.
- Go to Home → Conditional Formatting → Highlight Cells Rules → Duplicate Values.
- Keep Duplicate to color the matches, or switch to Unique to color the values that appear only once.
Pros: two clicks, no formulas. Cons: it only colors cells – and a value repeated inside one list is highlighted as well, even if it isn't in the other list.
2. Highlight matches or differences with a formula rule
A formula rule only looks at the other list, so it doesn't have the problem above.
- Select A2:A100.
- Go to Home → Conditional Formatting → New Rule → Use a formula to determine which cells to format.
- To highlight values of A that also appear in B, enter:
=COUNTIF($B$2:$B$100,$A2)>0
- To highlight values of A that are missing from B, use this instead:
=COUNTIF($B$2:$B$100,$A2)=0
- Click Format, pick a fill color and confirm. Repeat with the ranges swapped to color List B.
The $ signs matter: $B$2:$B$100 stays fixed while $A2 moves down one row for each cell.
3. Mark each item as "Match" or "No match" (COUNTIF or MATCH)
When you want a result you can filter and sort, add a helper column. In C2 enter:
=IF(COUNTIF($B$2:$B$100,A2)>0,"Match","No match")
MATCH does the same and stops at the first hit, which is a little faster on long lists:
=IF(ISNUMBER(MATCH(A2,$B$2:$B$100,0)),"Match","No match")
Fill the formula down, then use Data → Filter on column C to show only matches or only differences. Replace "Match" with COUNTIF(...) alone if you also want to know how many times each value appears in List B.
4. Find matches and return related data (VLOOKUP or XLOOKUP)
If List B has extra columns – say, prices in column C – a lookup tells you whether there is a match and brings back the related value.
With XLOOKUP (Excel 365 and Excel 2021 or later):
=XLOOKUP(A2,$B$2:$B$100,$C$2:$C$100,"Not found")
With VLOOKUP (all versions):
=IFERROR(VLOOKUP(A2,$B$2:$C$100,2,FALSE),"Not found")
Always use FALSE (exact match) in VLOOKUP when comparing lists; otherwise Excel may return the wrong row. XLOOKUP is exact by default, can look to the left, and has a built-in "not found" value.
5. Extract all matches or differences into a new list (FILTER)
In Excel 365 and Excel 2021, one formula can return the complete list of matches – it spills into the cells below automatically.
Values of A that are also in B:
=FILTER(A2:A100,COUNTIF(B2:B100,A2:A100)>0,"No matches")
Values of A that are not in B:
=FILTER(A2:A100,COUNTIF(B2:B100,A2:A100)=0,"No differences")
Wrap the result in UNIQUE() to remove duplicates and SORT() to sort it, for example =SORT(UNIQUE(FILTER(...))). Swap the ranges to get the values that are only in B.
6. Compare two columns row by row
Sometimes the question is not "is this value anywhere in the other list?" but "is row 5 the same in both columns?". Then compare cell by cell:
=IF(A2=B2,"Same","Different")
The = comparison ignores case ("Apple" equals "apple"). For a case-sensitive check, use EXACT:
=IF(EXACT(A2,B2),"Same","Different")
To highlight the differing rows instead, select A2:B100 and add a conditional formatting rule with the formula =$A2<>$B2.
7. Advanced Filter (extract differences in older Excel)
Without FILTER, Advanced Filter can copy the values that are missing from the other list:
- In an empty cell, for example E2, enter the criteria formula
=COUNTIF($B$2:$B$100,A2)=0. Leave E1 empty or give it a label that is not a column header. - Select A1:A100 (including the header) and go to Data → Advanced.
- Choose Copy to another location, set Criteria range to E1:E2 and Copy to to an empty cell.
- Click OK. Use
>0instead of=0in step 1 to copy the matches.
8. Power Query (large or recurring comparisons)
For tens of thousands of rows, or comparisons you repeat every week, Power Query is the most robust option.
- Turn each list into a table (Insert → Table).
- Select one table and choose Data → From Table/Range; repeat for the other table.
- In Power Query, choose Home → Merge Queries, select both tables and the column to compare.
- Pick the Join Kind:
- Inner – items in both lists (matches)
- Left Anti – items only in the first list
- Right Anti – items only in the second list
- Full Outer – everything, with blanks where there is no match
- Click Close & Load. When the source data changes, Data → Refresh All updates the result.
9. Legacy array formula (Excel 2019 and earlier)
Without FILTER, this array formula lists the values of A that are not in B, one per row. Enter it in C2 with Ctrl+Shift+Enter, then fill it down:
=IFERROR(INDEX($A$2:$A$100,SMALL(IF(COUNTIF($B$2:$B$100,$A$2:$A$100)=0,ROW($A$2:$A$100)-ROW($A$2)+1),ROWS($C$2:C2))),"")
It works, but it is hard to read and slow on large ranges. If you have Excel 365, use FILTER (method 5) instead.
Why don't my lists match? Common problems
- Extra spaces: "Apple " and "Apple" are different values. Clean the data with
=TRIM(A2)first. - Numbers stored as text:
123and"123"don't match. Use Data → Text to Columns → Finish or=VALUE(A2)to convert them. - Case: COUNTIF, MATCH, VLOOKUP and XLOOKUP ignore case. Only
EXACTis case-sensitive. - Slow workbooks: whole-column references such as
B:Bin thousands of formulas slow Excel down. Limit the ranges, or use a table.
Summary: which method should you use?
| Method | Excel version | Result | Best for |
|---|---|---|---|
| Duplicate Values highlight | All | Colors cells | Quick visual check |
| Formula conditional formatting | All | Colors matches or differences | Accurate highlighting |
| COUNTIF / MATCH helper column | All | Match / No match flag | Filtering and counting |
| XLOOKUP / VLOOKUP | XLOOKUP: 365, 2021+ | Returns related data | Matches with extra columns |
| FILTER | 365, 2021+ | New list of matches or differences | Extracting results |
Row-by-row (= / EXACT) |
All | Same / Different per row | Aligned columns |
| Advanced Filter | All | Copied list | Extraction in older Excel |
| Power Query | 2016+ | Refreshable table | Large or recurring jobs |
| Array formula | All | List of differences | Older Excel without FILTER |
For most everyday tasks, a COUNTIF helper column or a formula-based highlight is enough. Use XLOOKUP when you need data from the other list, FILTER when you want the matches as a separate list, and Power Query for large or recurring comparisons. And if the data isn't in Excel yet, the online list comparison tool gives you the same answer without any formulas.