ExcelReady
CourseMock testsFunction guidesBlog
Start freeStart learning for free
ExcelReady

Be Excel-ready before day one. Hands-on practice in your browser, with instant feedback.

Learn

  • Course
  • Mock tests
  • Function guides
  • Blog

Test prep

  • Excel level test
  • Excel test practice
  • Free screening quiz
  • Certificate

Company

  • Editorial policy
  • Contact
  • Terms
  • Privacy

© 2026 ExcelReady. All rights reserved.

  1. Blog
  2. Lookups
  3. How to Compare Two Lists in Excel

How to Compare Two Lists in Excel

By ExcelReady Team·Updated November 1, 2026·5 min read

The short answer

To compare two lists in Excel, use COUNTIF to check whether each item in one list appears in the other: =IF(COUNTIF($C$2:$C$6,A2)>0,"Yes","No"). To list the missing items in one go, use FILTER with COUNTIF. To see the differences at a glance, add a conditional formatting rule that highlights items with no match.

Key takeaways

  • COUNTIF(other_list, item) returns 0 when an item is missing, so it is the simplest way to compare lists.
  • Lock the other list with $ signs before copying the formula down.
  • FILTER with COUNTIF lists every missing item at once in Microsoft 365 and Excel 2021.
  • Conditional formatting with a COUNTIF rule highlights the differences without extra columns.
  • Hidden spaces make matching items look different, so clean both lists with TRIM first.
On this page+
  1. Which method should you use?
  2. Compare two lists with COUNTIF
  3. Compare lists with XLOOKUP
  4. List the missing items with FILTER
  5. Highlight differences with conditional formatting
  6. Compare two lists row by row
  7. Why matching items show as missing
  8. Practise it

To compare two lists in Excel, you check each item in one list against the other and flag the ones that are missing. COUNTIF does this in one short formula, FILTER pulls out every missing item at once, and conditional formatting highlights the gaps without any helper column. This guide shows all three on the same small example, plus how to compare lists row by row.

All the examples use an event sign-up list and an attendance list:

ABC
1RegisteredAttended?Attended
2AnaBen
3BenDev
4ChloeElla
5DevGus
6EllaAna
7Femi

The question is simple: who registered but didn't come, and who came without registering?

Which method should you use?#

The right method depends on what you want to see. This table sums them up:

You wantMethodWorks in
A Yes/No flag next to each itemIF + COUNTIFEvery version
The matching value or a messageXLOOKUPExcel 2021, Microsoft 365
A separate list of missing itemsFILTER + COUNTIFExcel 2021, Microsoft 365
Coloured cells, no formulas in the dataConditional formattingEvery version
Lists in the same order, row by row=A2=C2 or EXACTEvery version

Compare two lists with COUNTIF#

COUNTIF counts how many times an item appears in the other list, so a result of 0 means the item is missing. In B2, type:

Excel formula
=IF(COUNTIF($C$2:$C$6,A2)>0,"Yes","No")

Copy it down to B7 (Windows: Ctrl+D; Mac: ⌘D). You get Yes for Ana, Ben, Dev and Ella, and No for Chloe and Femi. Those two registered but didn't attend.

The $ signs lock the attendance list, so every row checks the same range. A2 has no $, so it moves down to A3, A4 and so on. If you only want the count, =COUNTIF($C$2:$C$6,A2) on its own is fine: 1 means found, 0 means missing, and 2 or more means the name appears twice. The COUNTIF guide with criteria examples explains the function in depth.

To check the other direction, put the same formula next to the second list with the ranges swapped: =IF(COUNTIF($A$2:$A$7,C2)>0,"Yes","No"). Gus gets No, because he attended without registering.

Compare lists with XLOOKUP#

XLOOKUP is useful when you want to bring back the matching value or show a clear message. In B2:

Excel formula
=XLOOKUP(A2,$C$2:$C$6,$C$2:$C$6,"Missing")

Found names come back as themselves, and Chloe and Femi show Missing. The real power shows when the second list has more columns: change the return range to, say, a check-in time column, and you compare and fetch in one step. XLOOKUP needs Excel 2021 or Microsoft 365; see the XLOOKUP function guide for the syntax.

List the missing items with FILTER#

FILTER with COUNTIF gives you a clean list of everything missing, in one formula. In an empty cell, type:

Excel formula
=FILTER(A2:A7,COUNTIF(C2:C6,A2:A7)=0)

The result spills into two cells: Chloe and Femi. Here COUNTIF checks all six names at once and returns 0 for the missing ones, and FILTER keeps only those.

Swap the ranges to see the other side: =FILTER(C2:C6,COUNTIF(A2:A7,C2:C6)=0) returns Gus. To count how many registered people attended, use =SUMPRODUCT(--(COUNTIF(C2:C6,A2:A7)>0)), which returns 4. FILTER needs Excel 2021 or Microsoft 365. Make sure the cells below are empty, or you'll get a #SPILL! error.

Highlight differences with conditional formatting#

Conditional formatting colours the missing items, so you can see the differences without adding columns. Here's how:

  1. Select A2:A7.
  2. Go to Home > Conditional Formatting > New Rule.
  3. Choose Use a formula to determine which cells to format.
  4. Enter =COUNTIF($C$2:$C$6,A2)=0 and pick a fill colour.
  5. Click OK.

Chloe and Femi turn coloured. Write the formula for the first cell of your selection, A2, and Excel adjusts it for the rest.

For a quick look at items in both lists, select both columns and use Home > Conditional Formatting > Highlight Cells Rules > Duplicate Values. Every name that appears in both lists gets highlighted. This also flags repeats within one list, so use it for a fast check, not a final answer.

Compare two lists row by row#

If both lists are in the same order and you want to know whether each row matches, compare the cells directly:

Excel formula
=A2=C2

This returns TRUE or FALSE for each row. It ignores capitals, so "ana" equals "Ana". When capitals matter, such as product codes, use =EXACT(A2,C2) instead, which is case-sensitive. Row-by-row checks are common for reconciling two exports of the same report.

Why matching items show as missing#

If an item you can see in both lists shows No or Missing, the two values aren't identical to Excel. The usual causes:

  • Extra spaces. "Ben " with a trailing space doesn't match "Ben". Clean both lists with TRIM.
  • Numbers stored as text. An ID of 1042 and the text "1042" don't match. Convert them so both are numbers.
  • Different spellings. "Dev" and "Devendra" are different values. Agree on one version first.

These are the same issues that break lookups. The lookup errors practice has tasks built around them. For counting the distinct names after you compare, see how to count unique values. If you track sign-ups often, the attendance tracker walkthrough builds this check into a reusable sheet, and COUNTIF vs COUNTIFS explains when to compare on two columns at once. The COUNTIF function guide has a quick syntax reference.

Practise it#

Comparing lists is a very common task in data and operations job tests. Practise COUNTIF in a live spreadsheet: you type the formula, it checks the result instantly, and you learn the criteria rules that make list checks work. Then try the data analyst Excel mock test to compare and clean data under time pressure.

Try it yourself

This is a live spreadsheet. Type the formula in the green cell and press Enter.

Did Chloe (in A4) attend? In B4, use IF and COUNTIF to show Yes if A4 appears in the Attended list C2:C6, and No if it doesn't.

fx
ABCD
1
Registered
Attended?
Attended
2
Ana
Ben
3
Ben
Dev
4
Chloe
Ella
5
Dev
Gus
6
Ella
Ana
7
Femi
8
9
10

Tip: COUNTIF(C2:C6,A4) counts how many times Chloe appears. If that is more than 0, show Yes.

Practise this in a lesson

LessonFixing lookup errorsDiagnose #N/A, #REF! and silent wrong answers in lookups, then handle missing items gracefully.LessonCOUNTIFCount the cells that match a condition, from exact words to number checks like ">=8".Function guideCOUNTIFCount cells that match one condition with COUNTIF: text, numbers, wildcards and cell references. Real examples and a live exercise.Function guideXLOOKUPXLOOKUP explained with real examples: exact matches, looking left and custom not-found messages, plus a live exercise to try now.

Frequently asked questions

How do I compare two lists in Excel for matches?

+

Next to the first list, type =IF(COUNTIF($C$2:$C$6,A2)>0,"Yes","No") and copy it down. Yes means the item is also in the second list; No means it is missing.

How do I find items in one list but not the other?

+

In Microsoft 365 or Excel 2021, use =FILTER(A2:A7,COUNTIF(C2:C6,A2:A7)=0). It lists every item from the first list that doesn't appear in the second.

How do I highlight differences between two lists?

+

Select the first list, go to Home, Conditional Formatting, New Rule, and choose Use a formula. Enter =COUNTIF($C$2:$C$6,A2)=0 and pick a fill colour. Items missing from the second list light up.

Is comparing lists with COUNTIF case-sensitive?

+

No. COUNTIF treats Ana and ANA as the same. If capitals matter, compare matching rows with EXACT, which returns TRUE only when the text matches exactly, including case.

Why do matching items show as missing?

+

Usually one list has extra spaces or numbers stored as text. Clean both lists with TRIM, and make sure numbers are real numbers in both, then compare again.

Sources

  • COUNTIF function - Microsoft Support
  • FILTER function - Microsoft Support
  • Use conditional formatting to highlight information - Microsoft Support

Written and checked by the ExcelReady Team. First published November 1, 2026. The practice exercise runs in the same formula engine as our lessons. Found a mistake? Read our editorial policy or email hello@excelready.app.

On this page

  1. Which method should you use?
  2. Compare two lists with COUNTIF
  3. Compare lists with XLOOKUP
  4. List the missing items with FILTER
  5. Highlight differences with conditional formatting
  6. Compare two lists row by row
  7. Why matching items show as missing
  8. Practise it

Keep reading

Projects· 6 min read

Build an Order Tracker in Excel

An order tracker in Excel is a table with one row per order: order ID, customer, order date, ship date, status and amount. XLOOKUP finds any order's status from its ID, COUNTIF counts orders in each status, and the ship date minus the order date shows how many days each order took to ship. Conditional formatting flags slow orders.

Comparisons· 7 min read

COUNTIF vs COUNTIFS: What's the Difference?

COUNTIF counts cells that meet one condition, such as tickets marked Open. COUNTIFS counts rows that meet several conditions at once, such as Open tickets with High priority, and every condition must be true. COUNTIFS with one pair works exactly like COUNTIF, so many people simply use COUNTIFS for everything.

Projects· 5 min read

Make an Attendance Tracker in Excel

To make an attendance tracker in Excel, put names in column A and dates across row 1, then type a code in each cell: P for present, A for absent, L for late. COUNTIF counts each code per person, and dividing by the days recorded gives an attendance rate. Conditional formatting colors absences and low rates automatically.

Don't just read about Excel. Do it.

Practise real formulas in a live spreadsheet with instant feedback, right in your browser. Nothing to download.

Start learning for free