ListCompare

How to Compare Two Lists in Excel or Google Sheets

Four ways to compare two columns in Excel and Google Sheets: COUNTIF, XLOOKUP, conditional formatting and a FILTER formula. Which one to use for what.

Updated 2026-11-29

There are four practical ways to compare two lists in a spreadsheet. Each answers a slightly different question, so pick the one that matches what you actually want to know.

1. COUNTIF — which values exist in the other list

Put this next to column A and drag down: =COUNTIF($B$2:$B$500,A2). A result of 0 means the value from A does not appear in B at all. Anything above 0 means it does, and the number is how many times.

This is the fastest check when you only need a yes/no per row and your data is already in the sheet.

2. XLOOKUP — pull the matching value across

=XLOOKUP(A2,$B$2:$B$500,$B$2:$B$500,"") returns the matching value or an empty string. Use it when you need to see what the match actually was, not just whether one exists. In older Excel, INDEX/MATCH does the same job.

3. Conditional formatting — visualize the gap

Select column A, then Home → Conditional Formatting → New Rule → Use a formula: =COUNTIF($B$2:$B$500,A2)=0. Set a fill colour. Every value missing from B is now highlighted.

This is the one to use when a human needs to look at the result rather than consume it.

4. FILTER — get the missing values as a list

=FILTER(A2:A500,COUNTIF(B2:B500,A2:A500)=0) spills every value from A that is missing in B into one column. Swap the ranges for the other direction. This is the closest to what a dedicated list comparison tool returns.

Which to use

You wantUse
A yes/no next to each rowCOUNTIF
The matching valueXLOOKUP
A visual scanConditional formatting
A clean list of missing itemsFILTER
Both directions at once, plus a CSV exporta dedicated tool

All four formulas assume values match exactly. Trailing spaces will break them — run TRIM on both columns first if your data came from an export.

Compare your own lists

Paste two lists and see what is only in A, only in B, and in both — then export the result as CSV.

Open the list comparison tool →