To compare two Excel lists and find missing items, put each list in its own column and use a formula that checks whether each item in List A appears in List B. The simplest formula is =IF(COUNTIF($C$2:$C$9,A2)=0,"Missing","Found"), which uses a basic function, and I did not check which Excel versions support it. COUNTIF counts how many cells in a range match an item, so a result of 0 means the item is missing. If you have XLOOKUP, you can use =XLOOKUP(A2,$C$2:$C$9,$C$2:$C$9,"Missing"). Run the check both ways, A against B and B against A, because each list can have items the other lacks. Clean extra spaces first, and keep a copy of your file. Here are the steps, the formulas, how to highlight missing items and what I could not confirm.
Set Up the Example
These cells are my own example. Put List A (your master list) in column A and List B (the list you are checking) in column C, with headers in row 1.
| Cell | List A (A2:A9) | Cell | List B (C2:C9) |
|---|---|---|---|
| A2 | Ali Khan | C2 | Sara Ahmed |
| A3 | Sara Ahmed | C3 | Bilal Raza |
| A4 | Bilal Raza | C4 | Hina Malik |
| A5 | Hamza Iqbal | C5 | Ali Khan |
| A6 | Hina Malik | C6 | Usman Tariq |
I show only five rows to keep the table short, but the formulas below are written for rows 2 to 9. Change the ranges to match your own data. Here, Hamza Iqbal is in List A but not in List B, and Usman Tariq is in List B but not in List A.
Before You Start
- Save a copy of the file. This is general advice.
- Clean the data. Microsoft says leading or trailing spaces can make COUNTIF return an unexpected value, and recommends TRIM or CLEAN. Its MATCH help page lists hidden spaces and numbers stored as text as causes of #N/A errors.
- Case does not matter. Microsoft says COUNTIF criteria and MATCH are not case sensitive, so “ali khan” and “ALI KHAN” count as a match.
- Use the same data type in both lists. Microsoft says to check that the lookup value and the range have the same data type. A number stored as text will not match a real number.
Method 1: COUNTIF (Works in Most Versions)
- In cell B2, next to List A, type:
=IF(COUNTIF($C$2:$C$9,A2)=0,"Missing","Found") - Press Enter.
- Copy the formula down to the last row of List A, by dragging the fill handle at the cell’s lower-right corner.
- Filter or sort column B to see all the “Missing” rows.
COUNTIF’s syntax is COUNTIF(range, criteria). Microsoft’s own example uses a cell as the criteria, as here (A2). The dollar signs lock the List B range, so it does not shift when you copy the formula down. Locking the range is general advice, and not something I found on Microsoft’s COUNTIF page.
To check the other way, test List B against List A. In D2, next to List B, type =IF(COUNTIF($A$2:$A$9,C2)=0,"Missing","Found").
Wildcards: Microsoft says COUNTIF treats a question mark or asterisk in the criteria as a wildcard. If your items contain these characters, put a tilde (~) in front of them. This is rare for names, but it can matter for codes.
Method 2: XLOOKUP (Newer Excel)
- In B2, type:
=XLOOKUP(A2,$C$2:$C$9,$C$2:$C$9,"Missing") - Press Enter and copy the formula down.
Microsoft gives the syntax as XLOOKUP(lookup_value, lookup_array, return_array, [if_not_found], [match_mode], [search_mode]). The fourth argument, if_not_found, is the text you want when there is no match, here “Missing”. If you leave it out, Excel shows #N/A. The default match mode is an exact match. When the item is found, this formula returns the matching item from List B instead of “Found”.
Version warning: Microsoft’s XLOOKUP page lists Excel 2016 and 2019 in its “Applies To” box, but a note on the same page says XLOOKUP is not available in those two versions. The page contradicts itself, so test the formula in your version, or use Method 1.
Method 3: MATCH With IFERROR
- In B2, type:
=IFERROR(MATCH(A2,$C$2:$C$9,0),"Missing") - Press Enter and copy the formula down.
MATCH’s syntax is MATCH(lookup_value, lookup_array, [match_type]). Microsoft says a match_type of 0 finds the first value that is exactly equal, and that MATCH returns #N/A when there is no match. Here, IFERROR changes that error into the word “Missing”. When the item is found, the formula returns its position in List B. Do not leave match_type out, because Microsoft says the default is 1, which expects sorted data. Microsoft also warns that replacing an error “only identifies the error, but does not resolve it,” so IFERROR can hide other problems too. Check a few rows by eye.
Method 4: Highlight Missing Items With Conditional Formatting
- Select List A (A2:A9).
- On the Home tab, click Conditional Formatting, then New Rule.
- Choose the option Use a formula to determine which cells to format.
- Type:
=COUNTIF($C$2:$C$9,A2)=0 - Click Format, choose a fill colour, and click OK until the dialogs close.
Microsoft’s page for this feature describes the steps for Excel for Microsoft 365 for Mac, Excel 2024 and Excel 2021 for Mac, and shows a similar COUNTIF formula in its example. The Windows menu may look a little different. Any item in List A that is not in List B is shaded. Repeat the steps on List B with the formula =COUNTIF($A$2:$A$9,C2)=0.
Method 5: List All Missing Items at Once With FILTER (Newer Excel)
In a blank cell, you can try: =FILTER(A2:A9,COUNTIF(C2:C9,A2:A9)=0,"None missing")
Microsoft says FILTER’s syntax is FILTER(array, include, [if_empty]), that the result spills into the cells below, and that the if_empty argument avoids a #CALC! error when nothing is returned. FILTER is available in Excel for Microsoft 365, 2024 and 2021. I did not find a Microsoft page that shows FILTER combined with COUNTIF in this way, and I did not test it. Try it on a copy of your file. If it does not work in your version, use Method 1 and filter the “Missing” rows.
Common Problems
- Items you can see in both lists show as “Missing”. Look for extra spaces, hidden characters, or numbers stored as text. Use TRIM or CLEAN, as Microsoft advises.
- The result changes when you copy the formula. The range is not locked. Use dollar signs on the List B range.
- Spelling differences. “Mohammad” and “Muhammad” will not match. Excel compares exact text, apart from case. This is general advice.
- Lists in different workbooks. Microsoft says COUNTIF gives a #VALUE! error if it refers to a range in a closed workbook, so keep both files open.
- Very long text. Microsoft says COUNTIF gives wrong results when matching text strings longer than 255 characters.
What I Could Not Confirm
- The exact formulas in this article. I took the function syntax and behaviour from Microsoft’s help pages, but I did not run these formulas in Excel. Test them on a copy of your data. The example lists are my own.
- FILTER with COUNTIF. I did not find a Microsoft page showing this combination, and I did not test it.
- The Windows menu for conditional formatting. The Microsoft page I opened is for Excel on Mac, 2024 and 2021. I did not check the Windows labels.
- XLOOKUP in Excel 2016 and 2019. Microsoft’s page contradicts itself, so I could not confirm availability.
- Excel for the web and phone. I did not check menu or function differences.
- ISNA, VLOOKUP and Power Query. I did not open Microsoft pages for these, so I give no steps for them. Excel’s Remove Duplicates, Power Query merge and the Inquire add-in also compare data, and I did not check them.
- Large lists. I did not check how these formulas perform on tens of thousands of rows.
- Other programs. I did not check Google Sheets, WPS Office or LibreOffice.
This is general information, not an official notice. Microsoft is the final authority on its own functions.
Frequently Asked Questions
How do I find items in one Excel list that are missing from another?
Use =IF(COUNTIF($C$2:$C$9,A2)=0,"Missing","Found") next to List A, and copy it down. A result of “Missing” means the item is not in List B.
Is the comparison case sensitive?
No. Microsoft says COUNTIF criteria and MATCH ignore case.
Why does Excel say an item is missing when it is there?
Usually extra spaces, hidden characters or numbers stored as text. Microsoft recommends TRIM and CLEAN.
Which formula should I use, COUNTIF or XLOOKUP?
COUNTIF is a basic function, and XLOOKUP is newer. XLOOKUP lets you set the “Missing” text directly, but check that your Excel version has it.
How do I highlight the missing items?
Use Conditional Formatting with the formula =COUNTIF($C$2:$C$9,A2)=0 on List A.
Do I need to compare both ways?
Yes. One check finds what List A has and List B lacks. The reverse check finds what List B has and List A lacks.
Can I compare lists in two different files?
Yes, but Microsoft says COUNTIF needs the other workbook to be open, or it returns a #VALUE! error.
Test the formula on a few rows you can check by eye before you trust it on the whole list.
