How to Compare Two Lists in Excel and Find Missing Items
Match order IDs even when two lists are in different orders. Flag missing records, check the reverse direction and catch duplicate IDs before reporting.
Follow these steps at your own pace. Check product terms and prices directly with providers before purchasing.
Quick answer
Put the master IDs in column A and the second list in column B. In C2, enter
=IF(A2="","",IF(COUNTIF($B$2:$B$100,A2)=0,"Missing","Found"))and fill down. Each ID in A is checked against the whole selected range in B. Adjust 100 to cover the last row of your second list.
1. Set up two lists that are out of order
Type Orders in A1, Sent in B1 and Check in C1. In A2 through A4 enter P101, P102 and P103. In B2 type P103 and in B3 type P101. Leave B4 empty. Comparing A2 directly with B2 would flag P101 even though it appears just one row lower in the sent list.
2. Test the match count first
Click C2 and enter =COUNTIF($B$2:$B$100,A2). A result of 1 means P101 appears once in the sent list. A result of 0 means the order is absent, and a result greater than 1 means the same ID appears more than once. The dollar signs keep the search range fixed as you copy the formula.
3. Turn the counts into a review list
Replace the formula in C2 with =IF(A2="","",IF(COUNTIF($B$2:$B$100,A2)=0,"Missing","Found")). Drag the fill handle from C2 down through C4. The outer IF leaves empty source rows blank. To see just the exceptions, select A1:C4, choose Data → Filter and pick Missing from the Check menu. Only P102 should remain.
| Order ID | Expected result | Reason |
|---|---|---|
| P101 | Found | Appears in B3 |
| P102 | Missing | Absent from B |
| P103 | Found | Appears in B2 |
4. Check the other direction
Clear the filter first. In D1 type Sent without order. In D2 enter =IF(B2="","",IF(COUNTIF($A$2:$A$100,B2)=0,"Review","OK")) and fill through D4. Type P999 in B4 to test it. D4 should say Review because P999 was marked sent but never appeared on the order list.
What this comparison can miss
COUNTIF ignores capitalization and treats a question mark or asterisk as a wildcard. Use this example for ordinary IDs such as P101. For a suspicious mismatch, compare the lengths with LEN and check for extra spaces or lost leading zeros. If quantities matter, keep the counts from step 2. A Found label alone cannot tell one shipment from two.
Microsoft Support · Use the COUNTIF function in Microsoft Excel
Comments
Read or join the discussion.