← All how-to recipes

How to compare two columns row by row

✓ Verified in LibreOffice 25.8.7.3 ✓ Verified in Google Sheets (2026-08-30)

Check whether each row's values match between two columns — reconciling exports, before/after lists.

The formula

AppFormulaNotes
Excel (desktop)=IF(A2=B2,"Match","Differ")Case-insensitive. Case-sensitive: =IF(EXACT(A2,B2),"Match","Differ").
Google Sheets=IF(A2=B2,"Match","Differ")Identical.
LibreOffice Calc=IF(A2=B2,"Match","Differ")Identical.

How it works

The = operator ignores case ("Widget" = "widget" is TRUE), which is usually what you want; EXACT compares byte-for-byte, which is why the verified example returns "Differ". Count the mismatches in one cell with =SUMPRODUCT(--(A2:A100<>B2:B100)). The other common surprise: trailing spaces from exports make identical-looking cells differ — wrap both sides in TRIM when reconciling pasted data. (Comparing whole LISTS regardless of order is a different task — see the find-values-in-both-lists recipe.)

Verified, not just documented

We ran =IF(EXACT(A2,B2),"Match","Differ") in LibreOffice 25.8.7.3 (headless, with forced recalculation) and it returned Differ — exactly the expected result. We then ran the same formulas in Google Sheets, executed 2026-08-30: a formula-only workbook goes into Google Drive, which converts it to a Sheet and recalculates every formula with Google’s own engine, and comes back out as .xlsx carrying the values Google computed. It returned Differ for the worked example, the same value LibreOffice produced. Both engines’ numbers on this page are executed results. The Excel formula follows Microsoft’s official documented syntax — we do not run desktop Excel.

Functions used

IF — see full Excel, Google Sheets & LibreOffice compatibility for each.

Related recipes

Related comparisons