How to use VLOOKUP to compare two lists: enter an exact-match VLOOKUP formula against List B for every item in List A, then reverse the two ranges to identify the remaining differences.

VLOOKUP is useful when each list has a reliable key column and you want a spreadsheet formula that can be filled down. One lookup direction answers “Does this List A item exist in List B?” It does not identify both directions of difference by itself, so a second lookup with the lists reversed is essential.

This guide covers the Excel formula, the data preparation that determines whether its results are trustworthy, and a separate local workflow for comparing pasted, one-item-per-line lists.

how to use vlookup to compare two lists
How to Use VLOOKUP to Compare Two Lists

Prepare two reliable lookup lists

Start with two worksheets named ListA and ListB. Put only comparison keys in column A of each sheet, one item per row, and keep any headers outside the lookup range. Before comparing, remove blank rows, decide whether capitalization matters, and ensure both lists use the same kind of value. VLOOKUP does not trim spaces or convert values such as the text “001” into the number 1.

Comparison scenario Excel result Working label Best response
The exact key exists in the lookup range VLOOKUP returns the matching value In both Keep it as a shared item
The exact key is absent VLOOKUP returns #N/A Only in A or Only in B Review it as a directional difference
The lookup range contains duplicate keys An exact lookup returns the first encountered match Matched under the current ordering Resolve duplicates if the associated record matters

Keep the formulas in empty helper columns instead of overwriting either source list. If both lists share one worksheet, place List A in column A and List B in column B, then adjust the ranges as shown below.

Build a VLOOKUP comparison in Excel

  1. Set up the source columns. Put the List A keys in ListA!A2:A100 and the List B keys in ListB!A2:A100. These are example ranges; extend them beyond the last populated row. Leave row 1 available for headers, but do not include a header inside the range you will search.
  2. Enter the forward comparison in ListA. In C2, enter =IFERROR(IF(VLOOKUP(A2,ListB!$A$2:$A$100,1,FALSE)<>"","In both","Only in A"),"Only in A"). Here, A2 is the lookup value, the ListB range is the table array, 1 selects its only column, and FALSE requests an exact match. IFERROR converts a missing match into the “Only in A” label.
  3. Fill the formula down. Copy C2 down beside every List A key. The dollar signs keep the List B range fixed while the A2 reference advances. If new rows are added later, extend both the source data and the formula range.
  4. Run the comparison in the opposite direction. In C2 of the ListB sheet, enter =IFERROR(IF(VLOOKUP(A2,ListA!$A$2:$A$100,1,FALSE)<>"","In both","Only in B"),"Only in B"). Fill this formula down as well. The first pass finds List A items missing from List B; the reverse pass finds List B items missing from List A.
  5. Adjust the references for one worksheet. If List A occupies A2:A100 and List B occupies B2:B100 on the same sheet, use =IFERROR(IF(VLOOKUP(A2,$B$2:$B$100,1,FALSE)<>"","In both","Only in A"),"Only in A") for List A. For List B, use =IFERROR(IF(VLOOKUP(B2,$A$2:$A$100,1,FALSE)<>"","In both","Only in B"),"Only in B").
  6. Return a second field when needed. If List B contains a key in column A and a status, owner, or date in column B, use =IFERROR(VLOOKUP(A2,ListB!$A$2:$B$100,2,FALSE),"Not found"). The lookup key must remain in the first column of the selected range; the column index of 2 retrieves the second field.
  7. Review and export the labels. Filter the helper columns for “Only in A” and “Only in B,” or copy the labeled results to another location. These formulas identify literal lookup results, not whether two records represent the same real-world entity.

Do not omit the FALSE argument when exact matching is required. With FALSE, Excel does not need the lookup column to be sorted. If the argument is omitted or set to TRUE, VLOOKUP can perform an approximate match instead, which can return the closest value rather than the intended item.

Read the results and avoid false differences

A VLOOKUP label only tells you whether the lookup succeeded. It does not explain why two apparently similar records failed to match. Review these common causes before treating an unmatched row as a genuine difference.

  • Capitalization: Exact-match text lookup in Excel does not distinguish “Apple” from “apple.” Confirm that treating those values as the same item is appropriate for your task.
  • Surrounding whitespace: VLOOKUP does not silently remove leading or trailing spaces. A key with an extra trailing space may appear unmatched even when the displayed text looks identical.
  • Data types: Text “001” and the number 1 are different stored values. Keep identifiers, codes, and names in consistent formats across both lists.
  • Duplicate lookup keys: An exact VLOOKUP returns the first matching record in the lookup range. If duplicates carry different associated values, a formula may retrieve a different record from the one you expected.
  • Incomplete ranges: A key outside the selected table array will appear unmatched. Also avoid including blank cells or headers when they could be mistaken for valid lookup values.

If you need a different spreadsheet lookup pattern, particularly for multi-column data, see Compare Two Lists with INDEX MATCH in Excel.

Use Compare Two Lists for a local line comparison

When the goal is a literal-line set comparison rather than a spreadsheet lookup, Compare Two Lists compares two pasted lists locally and provides five views: In both, Only in A, Only in B, Union, and Either not both. It does not read worksheet formulas or reproduce VLOOKUP’s ability to retrieve a value from another column.

  1. Paste one item per line. Put the List A items in the List A area and the List B items in the List B area. Do not paste a comma-separated row as one item, because the tool does not parse CSV or split commas. It trims surrounding whitespace, removes blank lines, and treats each remaining physical line as one item.
  2. Choose the case rule and compare. Decide whether letter case changes membership. By default, “Apple” and “apple” share one membership key; case-sensitive mode treats them as different. The selected policy applies consistently to duplicate removal and all five outputs.
  3. Inspect every output section. “In both” contains the common members. “Only in A” and “Only in B” are the directional differences. Union contains everything in either list, while Either not both contains the symmetric difference: items found in exactly one list. Results are not sorted; union order follows first occurrences from List A and then new List B members.
  4. Copy the labeled report and verify it. Copy all results after the browser confirms the clipboard action. If clipboard access is denied, the tool provides a manual-copy instruction rather than claiming success. The copied report uses uppercase headings, fixed section order, and LF-separated values; an empty section is shown with an em dash.

These labels follow standard set terminology: union includes members in either or both sets, and symmetric difference includes members in exactly one set. The same distinctions are documented in MDN’s JavaScript Set methods and Python’s set types.

Each input is limited to one million UTF-16 code units and 50,000 lines. If either limit is exceeded, the tool returns an explicit error without partial results. It also returns an explicit error if both lists are empty after trimming and blank-line removal. Duplicate keys keep their first displayed spelling and order, while whitespace inside a line remains part of the item. The tool does not normalize Unicode, remove punctuation, compare numbers numerically, resolve URLs, or perform fuzzy matching. Parsing, comparison, rendering, and clipboard writing happen locally; no input or result is sent to a comparison service or AI model.

Check the output before using it

Unmatched labels are signals for review, not automatic proof that two records belong to different people, products, or organizations. Before relying on either workflow:

  • Confirm whether case-sensitive matching is required.
  • Check leading and trailing spaces, blank lines, data types, and internal whitespace.
  • Resolve duplicate keys when the first occurrence is not sufficient.
  • Confirm that the lookup range covers every relevant row and excludes unintended headers or blanks.
  • Check the destination system’s own normalization rules. Editing either textarea in Compare Two Lists clears the prior result, so run the comparison again after changing an input.

The reliable Excel method is to use exact matching, run the formula in both directions, and inspect the underlying keys before treating “Only in A” or “Only in B” as meaningful differences.