Quick answer

To compare two columns row by row, type =A2=B2 in a third column and fill it down: TRUE means the two cells match and FALSE means they differ. Wrap it in IF for words, such as =IF(A2=B2,"Match","Different"). To check whether each value in one list appears anywhere in the other, use =COUNTIF($B$2:$B$100,A2)>0 instead. The comparison ignores capitals; use EXACT when they matter.

Comparing two lists comes up all the time in office work: last month’s prices against this month’s, the invoices you sent against the payments that came in, two exports that should hold the same customers. Excel has no Compare button, but a short formula does it, once you know which kind of comparison you need.

Two kinds of comparison

Before you write a formula, decide what “match” means. If the two columns describe the same items in the same order, such as each product’s old and new price, compare each row with the row beside it. If the lists hold the same kind of value in any order, such as invoice numbers sent and invoice numbers paid, check each value against the whole other list. The first takes a simple =; the second needs a function that searches, such as COUNTIF or XLOOKUP.

Compare two columns row by row

=B2=C2 asks whether B2 equals C2 and returns TRUE or FALSE. Put it inside IF to get a word instead. Say a supplier sent new prices and you want to see which ones changed:

Each row compares its own two prices. Toner and labels changed; the rest are the same. Filter column D for Changed to see only the new prices. In D3, =IF(B3=C3,"Same","Changed") returns Changed.
  1. In D2, type =IF(B2=C2,"Same","Changed").
  2. Fill it down to the last row.
  3. Turn on filters with Ctrl+Shift+L (Cmd+Shift+F on a Mac) and show only Changed.

For the difference itself, subtract: =C2-B2 shows how much each price moved.

Find values that are missing from the other list

When the lists aren’t in the same order, check each value against the whole other column. COUNTIF counts how many times a value appears in a range, so a count of 0 means it isn’t there:

COUNTIF looks for each invoice anywhere in the paid list. INV-2043 and INV-2046 appear nowhere in C2:C6, so they show Missing, whatever order the payments came in. In B4, =IF(COUNTIF($C$2:$C$6,A4)>0,"Paid","Missing") returns Missing.

Lock the searched range with dollar signs, so it stays C2:C6 as you fill the formula down. Swap the two lists to find the opposite: INV-2047 was paid but isn’t on the sent list.

XLOOKUP does the same job and can bring back a value from the matching row, such as the payment date: =XLOOKUP(A2,$C$2:$C$6,$D$2:$D$6,"Missing"). In older versions, =ISNUMBER(MATCH(A2,$C$2:$C$6,0)) returns TRUE when the value is found.

Highlight the differences

Conditional formatting can color the rows or values instead of adding a column. To color the rows that differ, select A2:C20 and choose Home > Conditional Formatting > New Rule > Use a formula to determine which cells to format, then type =$B2<>$C2 and pick a fill. To color the values missing from the other list, select A2:A20 and make a rule the same way with =COUNTIF($C$2:$C$20,A2)=0.

The built-in Duplicate Values rule treats two selected columns as one list, so it also colors a value that repeats within one column. How to use conditional formatting in Excel explains formula rules and the dollar signs in them.

For a quick look without a formula, select both columns and choose Home > Find & Select > Go To Special > Row differences. Excel selects the cells in each row that differ from the cell in the active cell’s column, the first column if you selected from left to right, and you can give them a fill color right away.

Why a match gets missed

Two values have to be identical to match, apart from capitals:

= ignores capitals but nothing else. Row 2 matches with = and fails with EXACT, which checks capitals too. The trailing space in row 3 fails both. In row 4, = sees a number and a text and says FALSE, while EXACT compares both as text.
  • =, COUNTIF and the lookups treat Ana and ANA as the same. Use EXACT inside IF when capitals must match too: =IF(EXACT(A2,B2),"Match","Different").
  • A space at the end of one value stops the match. Clean the column with TRIM first.
  • An ID typed as a number in one list and pasted as text in the other fails = and the lookup functions, even though the two look the same. Convert the text with Convert to Number, or compare with =A2=VALUE(B2).

The free lessons Decide with IF, Count what matches with COUNTIF and COUNTIFS and When a lookup can’t find a match practice the formulas above. To clear out values that appear twice in one list, see how to remove duplicates in Excel and the free lesson Remove duplicates and choose what counts as a copy.

Frequently asked questions

How do I compare two columns in Excel for matches?

Type =A2=B2 in a third column and fill it down: TRUE marks the rows where the two cells match. Use =IF(A2=B2,"Match","Different") for words instead of TRUE and FALSE.

How do I find values in one column that are not in another?

Use COUNTIF against the other column: =IF(COUNTIF($C$2:$C$100,A2)=0,"Missing","") marks each value in column A that appears nowhere in column C, whatever order the lists are in.

How do I highlight the differences between two columns?

Select the rows, choose Home > Conditional Formatting > New Rule > Use a formula to determine which cells to format, and enter =$A2<>$B2 with a fill color. Each row where the two cells differ is colored.

Is comparing two cells in Excel case-sensitive?

No: =A2=B2 treats Ana and ANA as equal, and so do COUNTIF and the lookup functions. Use =EXACT(A2,B2) when capitals must match too.

How do I compare two lists that are in a different order?

Don’t compare row by row; check each value against the whole other list with COUNTIF or XLOOKUP. Sorting both lists first isn’t needed.