Excel Compare Two Columns for Missing Values

Find each code in column A that does not appear anywhere in column B. Keep both lists and put a TRUE/FALSE result beside every A row. A repeated missing code still produces a result for each original row.

Exact answer

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
▤Annotated stepsExcel
1

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.

2

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.

3

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.

4

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.

5

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.

Paste sample data starting at A1

C2: A code missing from B

=COUNTIF($B$2:$B$7,A2)=0

D2: optional B code missing from A

=COUNTIF($A$2:$A$7,B2)=0
Expected C2:C7: A rows missing from B
CellA: CodeCount in BC: Missing from B?
C2C1001FALSE
C3C2000TRUE
C4C3002FALSE
C5C2000TRUE
C6C4000TRUE
C7C5000TRUE

If columns are cut off, scroll the table sideways.

Optional D2:D7: B rows missing from A
CellB: CodeCount in AD: Missing from A?
D2C3001FALSE
D3C1001FALSE
D4C6000TRUE
D5C3001FALSE
D6C7000TRUE
D7C8000TRUE

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 .

Microsoft: Use the COUNTIF function in ExcelGoogle: COUNTIF

=COUNTIF($B$2:$B$7,A2)=0

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=B2 to 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 C200 repeats 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 COUNTIF as 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.