Spreadsheet Practice

How to compare two lists and find matches in Excel

Formula (Excel and Google Sheets)

=IF(COUNTIF($D$2:$D$5,A2),"Registered","Not yet")

Check each item against the other list with COUNTIF: =IF(COUNTIF(other_list,A2),"In both","Only in list 1").

Result on the example
one result per row in B2, filled down to B8
Works in
Every current version
Google Sheets
Same formula

See it work

The formula is already in B2, filled down to B8. Change any input and the result updates, or edit the formula to experiment.

How it works

COUNTIF returns how many times the name appears in the other list: 0 when it's missing, 1 or more when it's there. IF treats 0 as FALSE and any other number as TRUE, so no comparison is needed.

=IF(COUNTIF($D$2:$D$5,A2),"Registered","Not yet")

Result"Registered"

  1. $D$2:$D$54 rows × 1 col: "Chidi", "Aiko", "Gus", "Fay"

    A range: 4 cells in one column.

  2. A2"Aiko"

    The value in A2.

  3. COUNTIF($D$2:$D$5,A2)1

    COUNTIF: Counts cells that meet one condition.

    • range$D$2:$D$54 rows × 1 col: "Chidi", "Aiko", "Gus", "Fay"
    • criteriaA2"Aiko"
  4. IF(COUNTIF($D$2:$D$5,A2),"Registered","Not yet")"Registered"

    IF: Returns one value if a test is true, another if false.

    • logical_testCOUNTIF($D$2:$D$5,A2)1
    • value_if_true"Registered"
    • value_if_false"Not yet"not used

In Google Sheets

The same formula works in Google Sheets: =IF(COUNTIF($D$2:$D$5,A2),"Registered","Not yet"). We ran it in Google Sheets mode on the same data and it returns the same results.

Other ways to do it

Each one was run on the same example sheet.

FormulaResultWhen to use it
=IF(ISNUMBER(MATCH(A2,$D$2:$D$5,0)),"Registered","Not yet")Registered, Not yet, Registered…MATCH returns a position or #N/A; ISNUMBER turns that into TRUE or FALSE.
=IF(ISNA(XLOOKUP(A2,$D$2:$D$5,$D$2:$D$5)),"Not yet","Registered")Registered, Not yet, Registered…XLOOKUP works too, and can return a related column from the other list instead of a label.

Common mistakes

  • Lock the other list with $ before filling down.
  • Names that differ only by a trailing space won't match. TRIM both lists.
  • To compare row by row (is A2 the same as D2?), use =A2=D2 instead; COUNTIF checks the whole list.

Try it yourself

Same data, empty answer cell. Your formula is graded instantly, then re-checked on changed data, so a typed-in number won't pass.

Compare two lists and find matches

In B2, show "Registered" when the invited name also appears in D2:D5, otherwise "Not yet". Fill down to B8.

Questions

How do I list the names that are missing from the other list?

Use FILTER: =FILTER(A2:A8,COUNTIF(D2:D5,A2:A8)=0).

How do I compare two columns in Google Sheets?

The same COUNTIF formula works in Google Sheets.

Checked by running on 2026-10-29: every formula and result on this page was calculated by the Spreadsheet Practice formula engine, in both Excel and Google Sheets modes.