Excel: Compare Two Lists and Return Differences with VLOOKUP

Use VLOOKUP with exact match and ISNA to flag or extract items in one Excel list that are missing from another, and check that the result is reliable.

The short answer

To find items in one list that do not appear in a second list, look up each item from the first list in the second list with an exact-match VLOOKUP. Then test whether the lookup returns #N/A. A #N/A result means the item was not found, so it is a difference. The core pattern for a value in A2 checked against a second list in B2:B6 is:

=IF(ISNA(VLOOKUP(A2,$B$2:$B$6,1,FALSE)),"Missing from B","In both")

Interpret the result within its scope. The comparison is one-directional, so it only shows what is in the first list but not in the second. To get the full set of differences, run it in both directions. VLOOKUP also answers only whether a value is present. It does not tell you how many times the value appears, and by default it ignores letter case. These choices determine whether the differences it reports are the ones you need.

A worked example

The lists below are hypothetical. List A is in A2:A7 and List B is in B2:B6. Row 1 holds the headers.

Row | List A (column A) | List B (column B)
2 | Apple | Banana
3 | Banana | Date
4 | Cherry | Elderberry
5 | Date | Grape
6 | Fig | Kiwi
7 | Grape |

Comparing List A against List B should return Apple, Cherry and Fig as differences. Comparing List B against List A should return Elderberry and Kiwi. The steps below produce and check those outputs.

Step 1: Prepare the lists

Most wrong results come from inconsistent data, not from the formula. Before comparing, check the following.

  • Stray spaces: "Apple " with a trailing space does not match "Apple". Clean the text in a helper column with =TRIM(A2). TRIM does not remove non-breaking spaces, which often come from web or system exports. For those, use =TRIM(SUBSTITUTE(A2,CHAR(160)," ")).
  • Numbers stored as text: the text "100" does not match the number 100. Convert both lists to the same type before comparing.
  • Wildcard characters: in exact-match mode, VLOOKUP treats * and ? in a text lookup value as wildcards. For example, an entry such as "A*" would match any item starting with A. If your data contains these characters, escape them with a tilde (~*, ~?) or use the case-sensitive EXACT method below, which does not apply wildcards.
  • Blank cells: leave blanks out of the ranges or expect them to be flagged, because a blank cell has no match in the other list.

Step 2: Flag differences row by row

In C2, enter the formula below and fill it down to C7. The dollar signs lock the lookup range so it does not shift as you copy. The 1 returns the first column of the range. FALSE forces an exact match.

=IF(ISNA(VLOOKUP(A2,$B$2:$B$6,1,FALSE)),"Missing from B","In both")

For the example, C2:C7 should read: Missing from B, In both, Missing from B, In both, Missing from B, In both. To compare in the other direction, enter this in D2 and fill down to D6. It should flag Elderberry (D4) and Kiwi (D6) as missing from A.

=IF(ISNA(VLOOKUP(B2,$A$2:$A$7,1,FALSE)),"Missing from A","In both")

Always use FALSE as the last argument. With TRUE, or with the argument left out, VLOOKUP does an approximate match. That mode assumes sorted data and can return a nearby value instead of #N/A, which hides real differences.

You may see IFERROR used instead of ISNA, for example =IFERROR(VLOOKUP(A2,$B$2:$B$6,1,FALSE),"Not in List B"). That version returns the matched value or the label. However, IFERROR catches every error type, including errors caused by a broken reference. ISNA reacts only to the not-found case, so a mistake elsewhere still shows up as an error instead of a false difference.

Step 3: Return the differences as a separate list

In Excel versions with dynamic arrays (Microsoft 365 and Excel 2021 or later), FILTER can pull the missing items into their own list. Enter this in a single empty cell and the results spill downward:

=FILTER(A2:A7,ISNA(VLOOKUP(A2:A7,B2:B6,1,FALSE)),"No differences")

For the example, this returns Apple, Cherry and Fig. Swap the ranges to list the items from B that are missing from A. FILTER is not available in older versions. There, use the helper-column flags from Step 2 and apply an AutoFilter to the flag column.

Optional: Highlight differences instead

To mark the differences in place, select A2:A7 and go to Conditional Formatting > New Rule > Use a formula to determine which cells to format. Enter the formula below and choose a fill colour. Apple, Cherry and Fig should be highlighted.

=ISNA(VLOOKUP($A2,$B$2:$B$6,1,FALSE))

How matching choices change the result

VLOOKUP ignores case, so "apple" and "APPLE" count as the same item. If case matters, such as for product codes, use EXACT instead. The formula below works without array entry because SUMPRODUCT handles the array:

=IF(SUMPRODUCT(--EXACT(A2,$B$2:$B$6))=0,"Missing from B","In both")

VLOOKUP checks presence, not quantity. If Banana appears twice in List A and once in List B, both Banana rows show "In both". This is right when you only need to know which values are missing. It is wrong when you need to reconcile counts. In that case, compare occurrences with COUNTIF. For example, the formula below flags a row when List A contains that value more often than List B:

=IF(COUNTIF($A$2:$A$7,A2)>COUNTIF($B$2:$B$6,A2),"Extra in A","OK")

Note that this flags every copy of the duplicated value, not only the surplus copies. Trimming and type conversion in Step 1 also change the result: they decide whether near-identical entries are treated as matches or as differences. Choose the cleaning you apply based on what your comparison is meant to show.

Step 4: Check the output

  • Count the flags: =COUNTIF(C2:C7,"Missing from B") should return 3 for the example. The counts of "Missing from B" and "In both" should add up to the number of rows in List A.
  • Cross-check with a second method: =SUMPRODUCT(--ISNA(MATCH(A2:A7,B2:B6,0))) counts the same differences independently and should also return 3.
  • Spot-check flagged items: search the other list for a few flagged values. If you find one, look for hidden spaces, text-versus-number mismatches or wildcard characters.
  • Confirm the ranges cover all your data: if a list grows, extend the references. You can also convert the lists to Excel Tables so the ranges expand automatically.

Limits of this guide

The formulas here use documented Excel functions, and the expected outputs were worked through for the small hypothetical example only. No performance testing on large lists was supplied, so this guide makes no claims about speed on large datasets. Function availability depends on your Excel version: FILTER and dynamic-array behaviour require Microsoft 365 or Excel 2021 or later. The VLOOKUP, ISNA, COUNTIF, EXACT and SUMPRODUCT patterns work in earlier versions.