Comparing Excel Lists: Step-by-Step Guide
In this article
Comparing two Excel lists means finding out which entries match, which appear on only one side, and where values differ between shared entries. Excel does this without any add-in: the quickest approach is a helper column of COUNTIF formulas next to one list, or a conditional formatting rule that highlights duplicates and gaps. Both work on Excel for Windows, Mac, and Excel for the web, and menu labels can differ slightly by version, device or region.
What You'll Need
- Two lists in the same workbook, ideally on separate sheets (for example ListA and ListB), with one value per cell.
- Each list with a clearly labelled header row and no blank rows in the middle. Blank rows make Excel's used range unreliable.
- A spare empty column on each sheet for helper formulas.
- Consistent spelling and formatting. Extra spaces or mixed case are the most common cause of a "missing" match that is actually there.
Step-by-Step
- Put the two lists side by side in your mind. Decide which list is the reference (say ListA, the old one) and which is the candidate for comparison (ListB, the new one). Write this down; you will build formulas in only one direction and the result reads backwards if you mix them up.
- Check that the key column is clean. The key is the column you are matching on, usually an ID, email address, SKU or name. Click the header of that column, then use the filter dropdown. Look for (Blanks), and remove or flag them. In a spare cell type
=LEN(A2)and drag it down to expose hidden trailing spaces; a length that looks one or two characters too long means stray spaces. - Trim the key values. In an empty column next to ListA, enter
=TRIM(A2)and fill down. Repeat next to ListB with its own key column. Copy the trimmed results, then paste them back over the original column using Paste Special > Values so the formula disappears and only text remains. This removes leading, trailing and doubled internal spaces, which are the number one reason two identical-looking values fail to match. - Build a match column on the second list. Next to ListB's first data row, enter a COUNTIF that points at the whole of ListA's key column. With ListA's keys in column A of a sheet named ListA, the formula reads
=COUNTIF(ListA!$A:$A,B2). Fill it down. A result of 1 or more means the value exists in ListA; a result of 0 means it does not. Use absolute references (the dollar signs) so the range does not shift as you fill. - Interpret the numbers rather than just scanning them. A count of 1 is a clean match. A count of 2 or more usually means ListA itself contains duplicates, so confirm whether ListB is matching one real entry or several. If you expect duplicates to matter, switch to a different formula:
=IF(COUNTIF(ListA!$A:$A,B2)>0,"In ListA","Not in ListA")gives a readable label instead of a number. - Find what is missing from the other direction. Copy the same formula into a new column next to ListA, pointing at ListB:
=COUNTIF(ListB!$A:$A,A2). Now both sheets show which of their rows exist in the other. A row that returns 0 on both sides cannot happen for the same value, so any value showing 0 on each list is unique to its own list. - Flag the results visually with conditional formatting. Select the match column on ListB, then open Home > Conditional Formatting > Highlight Cells Rules > Equal To and enter 0. Choose a fill colour. This turns every unmatched row red in one pass and makes large lists readable at a glance. Repeat for ListA's match column. If you prefer a formula-based rule, use Home > Conditional Formatting > New Rule > Use a formula to determine which cells to format and enter a rule such as
=COUNTIF(ListA!$A:$A,$B2)=0for the row range you selected. - Compare the other columns for matched rows. Knowing a value exists on both lists is only half the job. To spot changed values, such as a price or quantity that differs for the same ID, use a lookup. Next to ListB, enter
=XLOOKUP(B2,ListA!$A:$A,ListA!$C:$C,"Not found")to pull ListA's price for that ID. Then in the next column test them:=IF(D2=E2,"Same","Different"), where D is ListB's own price and E is the pulled value. Older Excel versions without XLOOKUP should use=IFERROR(VLOOKUP(B2,ListA!$A:$C,3,FALSE),"Not found")instead. Remember XLOOKUP and dynamic arrays are not available in very old releases, and Excel for the web supports them on current browsers. - Turn the formula results into fixed values before sharing. Select the helper columns, copy them, then use Paste Special > Values over the same cells. The file then still makes sense if someone else opens it, sorts it, or moves rows, because the results are text rather than references that can break.
- Sort and review. Apply a filter to the match column and show only 0. That filtered view is your list of differences. Sort the other columns the same way and check a handful of rows by hand against the source data. Manual spot checks catch formatting problems a formula cannot see, such as one list holding a number and the other holding the same digits stored as text.
- Save a copy before you delete anything. Keep the original two lists on separate sheets, untouched. Do the cleaning and comparison on copies. If you later need to explain or reverse a difference, the raw data is still there.
Common Mistakes
- Numbers stored as text. If one list shows keys left-aligned and the other right-aligned, one column is text. The formula will report no match even though the values look identical. Fix it with Data > Text to Columns on a copy of the column, or by using VALUE() in a helper column.
- Case sensitivity assumptions. COUNTIF and VLOOKUP ignore case, so abc and ABC match. If case matters, use
=EXACT(A2,ListB!A2)row by row instead. - Relative references that slide. Forgetting the dollar signs while filling down makes the lookup range drift and produces nonsense matches.
- Comparing whole rows when you only need the key. Matching on name alone breaks when two people share a name, or when "Smith, J" and "J Smith" both appear. Pick a genuinely unique key.
- Forgetting that blanks match blanks. An empty cell in one list will happily match an empty cell in the other, inflating your match counts.
Tips
- Name your ranges. Select a list and type a name in the Name Box (left of the formula bar), then use that name in formulas; the formulas become readable and easy to update.
- Put both lists on the same sheet for very small comparisons where you want to eyeball rows together, and on separate sheets for anything over a few dozen rows.
- For repeated comparisons, build a small template workbook once with the trimmed key column and the match column already in place, then paste new data in each time.
- Excel's Power Query (Data > Get Data) is a better fit when you compare lists regularly and they live in separate files, because it can refresh the comparison without rebuilding formulas.
Troubleshooting
Every row says "not found" including ones you know match. Compare the two key cells character by character. Check for trailing spaces, non-breaking spaces (often copied from web pages), and one list formatted as text. The LEN test from step 2 usually reveals it.
Some matches return 2 or more. That means duplicates exist in the reference list. Filter the reference list on the key, or use Data > Remove Duplicates on a copy, to see them. Decide whether the duplicate is legitimate before you delete anything. Remove Duplicates deletes rows permanently, so keep a backup.
The COUNTIF range misses the last rows. If you used a fixed range such as A2:A100 and your list is longer, the tail is ignored. Use whole-column references (A:A) or extend the range and refill the formula.
Conditional formatting paints the wrong cells. Check the rule's "Applies to" range and confirm the cell reference in the formula matches the top-left cell of that range. A rule written for row 2 will evaluate incorrectly if it is applied starting at row 5.
XLOOKUP gives a #NAME? error. That Excel version does not support it. Use INDEX and MATCH, or VLOOKUP with a fixed column number, instead.
Still mismatched after all that. Copy a few failing values into a plain text editor and paste them back, which strips invisible characters. As a last resort, retype one known-bad value by hand into both lists to see whether the match then succeeds.
Frequently Asked Questions
Can I compare two lists in different workbooks?
Yes. Point the formula at the other workbook by including its file name in brackets in the reference, and keep both files open. Closed workbooks make external references fragile, so copy both lists into one file when you can.
Does conditional formatting change my data?
No. It only formats cells, but a cell with conditional formatting applied has its formatting slightly modified so the rule can override it, which slightly increases file size.
What is the difference between a match column and Remove Duplicates?
A match column tells you which values appear in both lists and lets you keep both sets of data. Remove Duplicates deletes rows in place, permanently, so use it only on a copy.
Can I compare lists on more than one column?
Yes. Add a helper column that joins the values with a separator, such as =A2&"|"&B2, on both sheets, and match on those combined keys. The separator prevents accidental matches between different combinations.
Why do two identical-looking values fail to match?
Almost always hidden characters, a text-versus-number mismatch, or differing case where you expected an exact comparison. Clean the keys with TRIM first, then test with LEN.