Comparing two columns in Excel means deciding, before you touch a formula, whether you want a count of matches, a list of differences, or row-by-row proof — because each goal needs a different tool. If you want a quick match count, SUMPRODUCT(--(A2:A100=B2:B100)) returns it in one cell. If you want missing items from one list, VLOOKUP, XLOOKUP, or COUNTIF flags them. If you need cell-level differences like "apples" versus "Apples," Excel's built-in comparison is case-blind and EXACT is not. This guide walks through all six methods in the order you'd actually use them, starting with the one-step test most people skip.

Start With the Equals Operator Before You Write Any Formula

Type =A2=B2 in cell C2 and drag it down. Excel returns TRUE when the cells match and FALSE when they don't, and that single formula is the fastest way to find out whether your data is even aligned row by row. If you see#N/A anywhere, one of your cells contains an error — and no downstream comparison will work until you fix it.

The operator test costs almost nothing and saves real time. Most failed column comparisons I've seen trace back to misaligned rows: someone sorted column A but not column B, so every subsequent result is garbage. The =A2=B2 test exposes that instantly because FALSE appears in a suspiciously regular pattern rather than clustered where actual differences live. Press Ctrl+Down from the last row of your data to confirm both columns end at the same point — if column A has 500 rows and column B has 487, the extra 13 return FALSE against blank cells.

One thing to know before you trust the result: the equals operator ignores case and text formatting. "Widget" in A2 and "widget" in B2 return TRUE. If case matters for part numbers, SKUs, or login names, the operator will lie to you. Test it deliberately: type "Excel" in one cell and "EXCEL" in another, compare them, and watch TRUE pop up. That's not a bug — it's Excel's default behavior, and it's why EXACT exists as a separate function.

For a percentage rather than row-by-row output, wrap the whole range comparison in SUMPRODUCT and divide by the row count. With data in A2:A100 and B2:B100, =SUMPRODUCT(--(A2:A100=B2:B100))/ROWS(A2:A100) gives you the match rate as a decimal. Format the cell as a percentage and you have an audit trail your manager can read in two seconds.

VLOOKUP Flags Missing Records, but Its #N/A Result Wears Two Faces

Use VLOOKUP when you need to know which items from column A exist in column B. Set your column B range as the lookup table, use column A as the value, and put =VLOOKUP(A2,$B$2:$B$100,1,FALSE) in the adjacent cell. A returned value means the item exists; #N/A means it doesn't. That's the entire logic, and it's reliable as long as you lock the range with dollar signs before dragging.

The #N/A error is the trap. It means "not found" when the value genuinely isn't in the list, but it also appears when your lookup column contains leading or trailing spaces, non-breaking characters, or numbers stored as text. A SKU typed as "00412" with a leading apostrophe in column A but stored as a number in column B will fail every single time, even though the visible characters look identical. If your not-found rate looks suspiciously high, suspect hidden characters before you suspect real mismatches.

Strip whitespace with TRIM before you conclude anything. Wrap the lookup value: =VLOOKUP(TRIM(A2),$B$2:$B$100,1,FALSE). If that fixes some of the #N/A results, you had dirty data, not missing records. For non-breaking spaces, which TRIM does not remove, use =SUBSTITUTE(A2,CHAR(160),"") and then TRIM the output. These two cleanups resolve the majority of false negatives in real-world data.

Version matters here. VLOOKUP exists in every Excel version from Excel 2007 forward, including Excel for the web, Excel 2021, and Microsoft 365 Apps. The function signature hasn't changed in fifteen years, so a tutorial written in 2010 still works. That stability is why VLOOKUP remains in the Microsoft support documentation as the recommended lookup reference despite XLOOKUP's arrival in 2019.

XLOOKUP Returns a Cleaner "Missing" Message and Outperforms VLOOKUP on Both Speed and Readability

XLOOKUP, available in Microsoft 365 Apps, Excel 2021, and Excel for the web, replaces VLOOKUP's #N/A with whatever you specify. =XLOOKUP(A2,$B$2:$B$100,"Not in B","Found") returns the words you choose rather than an error. That alone makes it the better tool for anyone who has to share the sheet with colleagues who panic at red error cells.

Feature VLOOKUP XLOOKUP
Available since Excel 2007 Excel 2021 / Microsoft 365
Not-found output #N/A error Any value you specify
Lookup direction Right only (default) Any direction
Column-insertion safety Breaks if a column is inserted Safe — no index number
Range locking needed Yes ($B$2:$B$100) No
Exact-match default FALSE must be typed Built-in default

The column-insertion failure case deserves attention. With VLOOKUP, your third argument is a column index number — 3 means "return the third column of the lookup table." Insert a column to the left of that table and the index is now wrong, silently returning the wrong data with no error. That is the single most common VLOOKUP bug in production spreadsheets, and XLOOKUP eliminates it entirely because you name the return range directly rather than counting columns.

Speed matters at scale, too. On a 100,000-row lookup against a 50,000-row reference table, VLOOKUP's linear search visibly lags; XLOOKUP's binary search — default when the lookup array is sorted — returns in a fraction of the time. Microsoft's own documentation notes XLOOKUP was designed to replace both VLOOKUP and HLOOKUP, and the company lists it as the recommended function in its support library as of the Microsoft 365 release notes.

One caveat: XLOOKUP won't open in Excel 2019 or Excel 2016. If you share the file with users on older perpetual licenses, formulas return #NAME? on their machine. Confirm your audience's version before standardizing on it, or supply a VLOOKUP fallback in a separate column.

EXACT Catches Case and Space Differences That Every Other Formula Misses

Excel's comparison functions are case-insensitive and whitespace-tolerant, which silently hides real differences. EXACT(A2,B2) returns FALSE for "Widget" versus "widget" and for "Widget " (trailing space) versus "Widget." No other comparison function in Excel makes that distinction, and for product codes, username audits, or password-adjacent checks, the distinction is everything.

Combine EXACT with a conditional format to make case mismatches visible. Select column C, choose Conditional Formatting, then Highlight Cells Rules, then Equal To, type FALSE, and pick red fill. Every exact-match failure lights up. The same rule works on a thousands-row sheet in under a second, and the visual cue is easier to explain in a data-quality meeting than a formula anyone has to read.

The trailing-space gotcha is worth a dedicated formula. Because EXACT distinguishes "Widget" from "Widget ", it will flag rows where one column has a trailing space and the other doesn't — but you can't tell without looking. Add a helper formula: =LEN(A2)-LEN(TRIM(A2)) returns the number of stray spaces in the cell. A value above zero means the cell is dirty. Run this down column A and column B, and any positive number tells you to clean before trusting the comparison.

EXACT has been available in every Excel version since at least Excel 2007 and behaves identically on Windows, Mac, and Excel for the web. It takes exactly two arguments and returns only TRUE or FALSE — no error handling, no tolerance for wildcards. That simplicity is the point: if a match is exact, TRUE; if not, FALSE; nothing ambiguous in between.

Conditional Formatting Makes Row Differences Visible Without a Helper Column

For a visual proof you can screenshot and send, use Conditional Formatting's built-in duplicate-finder. The path is exact: Home tab, Conditional Formatting, Highlight Cells Rules, then Duplicate Values. Select both columns first, set the rule to "Unique," and every value that appears only once across the two columns turns a color you choose.

This works best when you're describing two lists rather than comparing aligned rows. Highlighting unique values on columns A and B side by side makes it obvious which items live in one list and not the other — useful for reconciling a vendor's shipment manifest against your own invoice before a call. Set the highlight color deliberately: the default red-on-light-red is easy to miss on a projector, so pick a strong fill such as orange.

Row-level comparison works differently. To highlight differences between A2 and B2 across every row, use a formula-based rule. Select A2:B100, choose Conditional Formatting, New Rule, then "Use a formula to determine which cells to format," and enter =$A2<>$B2. The leading dollar sign on the column is essential — without it, Excel compares only the first cell of each column and the rule goes haywire mid-range.

Formatting rules don't create values, so you can't sort, filter, or export by them. That limitation bites when you want to hand the differences to a colleague in a CSV. Combine the highlight with a helper column (Section 6 below) when you need both the visible cue and exported values. Of the two, exported values win more arguments than colors do.

The COUNTIF Family Counts Occurrences and Handles Duplicates Others Ignore

COUNTIF and its sibling COUNTIFS solve a problem the lookup functions can't: counting how many times an item appears on the other list. =COUNTIF($B$2:$B$100,A2) returns zero when the item in A2 is absent from B, one when it appears once, and two or more when duplicates exist in column B — which is exactly the detail VLOOKUP hides by returning the first match and moving on.

Duplicate handling is the reason some users still prefer COUNTIF for reconciliation. If column B is a raw transaction export with repeated order numbers and column A is a clean list of expected orders, COUNTIF tells you not just whether each expected order appears but how many times. A count of 3 for a single order number usually means three line items on one order — information you need before you call the two columns a mismatch.

Test the count formula on a small subset first. Pick five rows of column A, apply =COUNTIF($B$2:$B$100,A2), and check the values manually against a filtered view of column B. If the counts look right on five, they're right on five hundred. If one looks wrong, verify whether column B contains the value with a leading space — COUNTIF does not tolerate leading spaces in the criteria range the way some users expect.

COUNTIF exists in every version including Excel 2007, Excel 2019, Excel 2021, and Microsoft 365. COUNTIFS, for multiple criteria such as matching an order number and a status column simultaneously, arrived with Excel 2007. Both work in Excel for the web with one documented caveat: COUNTIFS in the web version cannot reference a closed workbook, so if your lookup range lives in a file that isn't open, the formula returns #VALUE!. Open the source file first, or copy the range into the current workbook.

Extract the Differences Into a Third Column With FILTER

Legacy array formulas can do this, but FILTER, available in Microsoft 365 and Excel 2021, does it in a single cell with no Ctrl+Shift+Enter. =FILTER(A2:A100,COUNTIF(B2:B100,A2:A100)=0,"All matched") spills a list of every value in column A that doesn't appear in column B. Change the ranges and you have the reverse list.

The output spills into the neighboring cells automatically, so make sure the cells below and to the right of the formula are empty. If they aren't, you'll see a #SPILL! error — Excel's way of saying it needs room to breathe. This is a common first-run stumble and not a formula error. Clear the cells below and the list appears.

For a bidirectional difference list, stack two FILTER formulas. One returns values in A missing from B; the other returns values in B missing from A. Use VSTACK to combine them: =VSTACK(FILTER(A2:A100,COUNTIF(B2:B100,A2:A100)=0,""),FILTER(B2:B100,COUNTIF(A2:A100,B2:B100)=0,"")). VSTACK requires Microsoft 365, so confirm your version — the Microsoft 365 Apps release notes list VSTACK as available since mid-2022, and it does not exist in Excel 2021 or earlier.

FILTER's dynamic nature means the output updates the instant someone changes a source cell. That's an advantage over Copy-Paste Values for audits that recur, but a hazard if you build a report on top of FILTER output and someone then deletes a row from the source. Copy the spilled result and paste as values if the output needs to stay frozen.

Reconcile Two Lists of Different Lengths Without Misreading the Blank Cells

Real spreadsheets rarely have equal row counts, and comparing a 487-row list to a 500-row list breaks every row-aligned method. The fix is to compare by value, not by position. Use COUNTIF against the whole reference column with the criterion set to the current cell, and blank cells in the shorter list simply return zero — which reads as "missing from the counterpart," which is likely the truth you want.

Before you accept that reading, verify the blanks are truly absent and not hidden. Filter the shorter column for "(Blanks)" and count the rows. If your column A has 13 internal blanks (not trailing blanks beyond row 487, but gaps mid-list), every one of them produces a false mismatch in any row-aligned method. Internal blanks are almost always a sign of merged cells or filtered data that was copied incorrectly, and both are fixable.

Remove trailing blanks before comparing, too. If column A ends at row 500 but column B visually ends at row 487, check rows 488 through 500 in column B for whitespace-only cells — Excel treats " " as text, not blank. Search with Ctrl+F, leave the find field empty, and tick "Match entire cell contents." Any cell found that way contains invisible characters and needs cleanup.

The worked calculation: if column A has 500 rows and column B has 487, and 12 internal blanks exist in the shorter column, the theoretical match rate is at most 475 divided by 500, or 95 percent, before you've even looked at the data. Anything below 95 percent means either real differences or unhandled blanks. Compare your measured rate against that ceiling and you'll know which.

Pick the Method by What You Have to Show, Not by What's Fastest

The fastest formula is not always the right choice, because the right choice depends on what the sheet has to prove. A formula answers; a formula the right person can read also persuades. Sort your actual need through this comparison before you start typing.

Reader's need Best method Typical output size Absorbs dirty data?
Quick row-by-row check =A2=B2 One TRUE/FALSE per row No — fails on whitespace
Find missing items from column A XLOOKUP or VLOOKUP One value or message per row No — clean first
Preserve case sensitivity EXACT TRUE/FALSE per row No
Visual proof for a screenshot Conditional Formatting Color fill, no values Partially
Count duplicates and occurrences COUNTIF / COUNTIFS One integer per row No — trims needed
Exportable difference list FILTER (with VSTACK) Spilled range you can copy No
Two lists of unequal length COUNTIF by value One integer per row Partial — verify blanks

Version decides part of it too. If you're on Microsoft 365 or Excel 2021, XLOOKUP and FILTER are available and should be your default. On Excel 2019 or Excel 2016, VLOOKUP and COUNTIF are the ceiling; XLOOKUP formulas will return #NAME? errors for anyone who opens the file. On Excel for the web, most functions work, but check the workbook-reference caveat for COUNTIFS before you build a report that pulls from a second file.

The method that survives round-tripping through email and Google Sheets is the helper-column approach. Others' software sometimes silently drops conditional formatting or converts an array formula into a mess. A plain column of TRUE/FALSE or a spilled list pasted as values travels intact. When the reader is external, favor the method whose output looks like data, not formatting.

FAQ

Why does VLOOKUP return #N/A for values I can see in both columns?

The usual cause is hidden characters — a leading space, trailing space, or non-breaking space that makes the cell contents different from the visible text. Test the cell with =LEN(A2) against =LEN(TRIM(A2)); a difference means whitespace is the culprit. The second most common cause is a number stored as text in one column and as a number in the other, which never matches regardless of appearance. Clean the lookup value with TRIM and re-run before you conclude a record is missing.

What's the fastest formula to count how many rows match?

=SUMPRODUCT(--(A2:A100=B2:B100)) returns the exact number of matching rows in a single cell, no dragging required. It's case-insensitive, so "Widget" and "widget" count as a match — the same limitation as the equals operator. For case-sensitive counting, replace the equality comparison with --EXACT(A2:A100,B2:B100) inside the same SUMPRODUCT. Total row count comes from ROWS(A2:A100), and dividing the match count by it gives you the match rate.

Can Excel compare two columns from different workbooks?

Yes, but the same-workbook caveats apply and the external reference must be open in Excel for web compatibility. Reference the other workbook as [WorkbookName.xlsx]Sheet1!$A$2:$A$100 in your formula, and keep the file name letter-perfect — renamed files break the link with no error until you refresh. A closed source workbook is fine on desktop Excel but blocks COUNTIFS in Excel for the web. Copy the source column into the active workbook when in doubt.

Do I need an add-in or a Python script for this?

No. Every comparison in this guide runs in standard Excel with no add-ins, no macros, and no external code. Add-ins like Kutools offer some convenience, but they lock you into a paid license and complicate file sharing. The formulas here are all native functions that open in any version that supports them, and the ones that don't (XLOOKUP, FILTER, VSTACK) are documented by Microsoft as belonging to the Microsoft 365 lineage.

Why does COUNTIF return 1 for a value I know appears three times?

A leading or trailing space in the criteria range makes COUNTIF treat "Widget" and "Widget " as the same on lookup but count only one of them per row, and a duplicated value in the criteria cell will confuse the count. More often, the "three appearances" you see are one appearance in the column plus two in adjacent columns you mis-scoped. Check your range boundaries with the F2 key, which outlines the actual referenced range.

What's the difference between XLOOKUP's "if_not_found" and IFERROR wrapping a VLOOKUP?

XLOOKUP's third argument returns your custom value the moment the value is missing — clean, readable, and no error event. Wrapping VLOOKUP in IFERROR hides all errors, including #REF! and #VALUE!, which can mask a broken formula. IFERROR is blunt; XLOOKUP's if_not_found is precise. If you're stuck on VLOOKUP, use IFERROR, but verify the formula works on a small sample first, because any hidden bug gets swallowed.

How do I compare two columns for a row where the order of values is swapped?

Row-aligned comparison can't detect a swap because it looks at A2 against B2 only. To catch swapped pairs, concatenate in both directions and count: =COUNTIFS($A$2:$A$100,B2,$B$2:$B$100,A2) returns a count above zero when a swap exists somewhere in the range. Run it as a helper column beside the data, and any row with a value of 1 or more is a candidate swap. Verify by hand before acting — the formula flags pairs, not causation.