Enter =COUNTIF($B$2:$B$7,A2)=0 in C2 and fill down through C7. TRUE means the code in that A row is absent from B2:B7; FALSE means it appears at least once. The dollar signs keep the B range fixed while A2 changes to A3, A4 and later rows. For the reverse direction, use =COUNTIF($A$2:$A$7,B2)=0 in D2 and fill through D7.
On this page8
Paste the sample into A1 on a spare sheet. It occupies A1:B7, including the List A and List B headers. Keep C and D empty for the helper results.
Label C1 Missing from B? Enter =COUNTIF($B$2:$B$7,A2)=0 in C2, then fill the formula down through C7. Do not include the header row in the counted range.
Check the six C results against the first table. C3, C5, C6 and C7 are TRUE. C200 appears in two missing A rows, so keep both rows when reviewing the result.
If you also need B codes missing from A, label D1 Missing from A? Enter =COUNTIF($A$2:$A$7,B2)=0 in D2 and fill through D7. D4, D6 and D7 are TRUE.
Keep A:B unchanged while you inspect the helper columns. Finding missing values does not require deleting repeated rows, removing duplicates or overwriting the original codes.
Check missing rows without changing either list
Paste the two-column sample into A1 of a spare sheet. Enter the C formula in C2 and fill through C7. The first table is the reference result for A missing from B; the second table is the optional reverse check in D2:D7.
A1C2: A code missing from B
=COUNTIF($B$2:$B$7,A2)=0D2: optional B code missing from A
=COUNTIF($A$2:$A$7,B2)=0| Cell | A: Code | Count in B | C: Missing from B? |
|---|---|---|---|
| C2 | C100 | 1 | FALSE |
| C3 | C200 | 0 | TRUE |
| C4 | C300 | 2 | FALSE |
| C5 | C200 | 0 | TRUE |
| C6 | C400 | 0 | TRUE |
| C7 | C500 | 0 | TRUE |
If columns are cut off, scroll the table sideways.
| Cell | B: Code | Count in A | D: Missing from A? |
|---|---|---|---|
| D2 | C300 | 1 | FALSE |
| D3 | C100 | 1 | FALSE |
| D4 | C600 | 0 | TRUE |
| D5 | C300 | 1 | FALSE |
| D6 | C700 | 0 | TRUE |
| D7 | C800 | 0 | TRUE |
If columns are cut off, scroll the table sideways.
- The six counts in B are 1, 0, 2, 0, 0, 0. Zero becomes TRUE in C; a positive count becomes FALSE.
- C3, C5, C6 and C7 mark 4 missing A rows. The distinct missing codes are C200, C400 and C500: 3 codes, not 4.
- The reverse counts in A are 1, 1, 0, 1, 0, 0. D4, D6 and D7 mark C600, C700 and C800.
- All six aligned-row equality checks are FALSE, but C100 and C300 still occur elsewhere in the other list. Aligned comparison is a different task.
- Keep A1:B7 unchanged and compare the helper results before changing your real data. The tables are fixed reference answers for this sample.
Documentation reviewed .
Excel for Windows: Enter the missing-from-B formula in C2 and fill down through C7. Keep the original codes in A:B. Use D2:D7 only for the optional reverse check.Excel for Mac: Enter the missing-from-B formula in C2 and fill down through C7. Keep the original codes in A:B. Use D2:D7 only for the optional reverse check.
What this does
COUNTIF counts how often the current code appears anywhere in the other list. Comparing that count with zero asks whether it is missing. The test is directional: an A code absent from B is a different result from a B code absent from A. It does not compare only the two cells on the same row. In this example every =A2=B2 comparison is FALSE, yet C100 and C300 occur in both lists. Nor does the formula create a distinct list: C200 is absent from B and occurs twice in A, so two original A rows are marked TRUE.
A worked example
C100 in A2 appears in B3, giving a count of 1 and FALSE in C2. C300 in A4 appears in B2 and B5, giving a count of 2 and FALSE in C4. C200 in A3 and A5, C400 in A6 and C500 in A7 have no occurrence in B. Their four rows are TRUE: the six flags are FALSE, TRUE, FALSE, TRUE, TRUE, TRUE. That is 4 missing A rows but 3 distinct missing codes: C200, C400 and C500. In the optional reverse check, C600, C700 and C800 are missing from A, so D4, D6 and D7 are TRUE. Start with the supplied nonblank text codes and bounded ranges before adapting the example.
In Google Sheets
Google Sheets documents COUNTIF(range, criterion), including cell-reference criteria. For these six nonblank text codes, use the same English =COUNTIF($B$2:$B$7,A2)=0 formula in C2 and fill to C7; the optional D formula checks the opposite direction. This is a basic formula example, not a claim that Excel and Sheets share every comparison rule or menu. COUNTIF is not case-sensitive. Asterisks and question marks in text criteria act as wildcards; a tilde escapes a literal wildcard. The sample codes contain none of those characters. Function names and argument separators can depend on spreadsheet settings.
Common mistakes
- Using
=A2=B2to find missing membership: it checks aligned cells rather than searching the whole other list. - Removing the dollar signs from the counted range, so the range moves while the formula fills down.
- Reporting four distinct missing codes: there are four missing A rows, but
C200repeats and the distinct code count is three. - Reversing the intended direction. The C formula checks A against B; the D formula checks B against A.
- Treating
COUNTIFas a case-sensitive literal comparison. Case is ignored and * or ? can act as patterns. Check spaces, nonprinting characters and text/number types when adapting real data. - Extending the result to blank rows without deciding how blanks should be handled. This example contains only nonblank text codes.
Frequently asked questions
Which result means the value is missing?
TRUE means COUNTIF found zero occurrences in the other list. FALSE means it found at least one. The result describes the row being checked, not the number of distinct missing codes.
Why is C200 marked missing twice?
It appears in A3 and A5 and nowhere in B2:B7. Both original rows meet the missing-from-B condition. Keeping both flags preserves the input rows; a separate distinct-code list would be a different output.
How do I check values in B that are missing from A?
Enter =COUNTIF($A$2:$A$7,B2)=0 in D2 and fill through D7. The supplied example marks B4, B6 and B7, containing C600, C700 and C800.
Is COUNTIF case-sensitive or always a literal match?
No. COUNTIF ignores case, and * and ? are wildcard criteria. Microsoft and Google document tilde escaping for literal wildcards. These examples deliberately use nonblank codes without wildcard characters; review your own criteria and data types before transferring the formula.
Should I use Remove Duplicates first?
No. The missing-row check can be performed while both original lists remain intact. Removing repeated codes changes the row population and can hide why the missing-row count differs from the distinct-code count.