To match data in two columns in Excel, the quickest route is a formula: put =A2=B2 beside your data to get TRUE or FALSE, or use =IF(COUNTIF($B$2:$B$100,A2)>0,"Match","No match") when the two lists are in a different order or different lengths. For a visual answer, select both columns and apply Conditional Formatting > Highlight Cells Rules > Duplicate Values. For a full comparison table with lookup values pulled across, use XLOOKUP (or VLOOKUP in older versions). This guide walks through each method, in order from simplest to most useful, and explains what to do when the results look wrong.

What You'll Need

  • Excel 2016 or later, Microsoft 365, or Excel for Mac. XLOOKUP requires a newer build; VLOOKUP works everywhere.
  • Two columns of data to compare, ideally on the same sheet but not necessarily.
  • An empty column beside your data for the formula results, plus a row of headers so you can keep track of which column is which.
  • A basic awareness of absolute references (the $ signs), because every list-comparison formula depends on them.

Note that menu names and ribbon labels can differ slightly between versions, platforms and regions, so if you cannot find an option exactly as written, look for the closest equivalent in the same tab.

Step-by-Step

  1. Clean both columns first. Select each column in turn and use Data > Text to Columns (or TRIM and CLEAN in a helper column) to remove leading and trailing spaces. Invisible spaces are the single most common reason two values that look identical fail to match. Also check for numbers stored as text: a small green triangle in the corner of a cell is the giveaway, and the error-checking menu can convert them.
  2. Decide what a match means. Are you checking whether the same value exists somewhere in the other list, or whether the value in the same row is identical? Same-row comparison is a different question from list membership, and the formula you choose depends on which one you need.
  3. Same-row comparison: in an empty column, click the first data row and type =A2=B2, then press Enter and fill the formula down. TRUE means the two cells are identical, FALSE means they are not. Wrap it in IF for readable output: =IF(A2=B2,"Match","No match"). This is case-insensitive, so "apple" and "Apple" count as a match.
  4. Exact case-sensitive check: use =EXACT(A2,B2), which returns TRUE only when text and capitalisation are identical.
  5. List membership check: in the first data row of an empty column, type =IF(COUNTIF($B$2:$B$100,A2)>0,"Match","No match") and fill down. Adjust the B range to cover the whole second list and keep the dollar signs so the range does not shift as you drag. This tells you whether each A value appears anywhere in column B, regardless of position.
  6. Check the reverse direction too. Copy the same formula into another column with the ranges swapped, so you also see which values exist in B but not in A. A one-way check misses items that appear only in the second list.
  7. Count how many times each value appears: =COUNTIF($B$2:$B$100,A2) gives a number instead of a label. Zero means no match, one means a clean single match, and anything higher flags duplicates you may need to resolve before trusting a lookup.
  8. Pull matching data across: to bring a related value (a price, a name, a status) from the matching row, use =XLOOKUP(A2,$B$2:$B$100,$C$2:$C$100,"Not found"). The fourth argument supplies a friendly result when the value is missing. In older versions use =IFERROR(VLOOKUP(A2,$B$2:$C$100,2,FALSE),"Not found").
  9. Get a colour-coded answer: select both columns, then go to Home > Conditional Formatting > Highlight Cells Rules > Duplicate Values. Choose the formatting you want; anything highlighted appears in both columns. This is the fastest way to eyeball two lists, and it updates automatically as you edit.
  10. Filter for the non-matches: turn on AutoFilter (Data > Filter) and filter your result column for "No match". You now have a clean list of the values that exist in one column but not the other, ready to copy elsewhere or follow up on.

Common Mistakes

  • Forgetting the dollar signs. Without $, the lookup range slides down as you fill the formula and later rows compare against the wrong cells. Lock the range before dragging.
  • Comparing a full column to a full column on different rows. =A:A=B:B is not a list comparison; it only checks row by row and returns a spill error or a misleading result. Use COUNTIF for membership.
  • Trailing spaces and non-breaking spaces. Values pasted from websites or exported files often carry a non-breaking space that TRIM does not remove; SUBSTITUTE with CHAR(160) does.
  • Numbers stored as text. "007" and 7 are not equal in Excel, and neither is a number with a leading apostrophe. Convert both columns to the same type before comparing.
  • Misreading duplicates. A COUNTIF result above one means the lookup will return the first occurrence only, which may not be the row you want.
  • Assuming FALSE means missing. In a same-row comparison, FALSE just means the two cells differ, not that the value is absent from the other list. Choose the right formula for the question.

Tips

  • Keep both lists in full-column form and use structured tables (Ctrl+T). Table references expand automatically, so you never need to update range ends.
  • Use a helper column that concatenates two fields, such as =A2&"|"&B2, when a match depends on more than one column.
  • Select the result column and press Ctrl+Shift+L to toggle filters quickly when you only need a one-off look at non-matches.
  • Copy results and paste as values before deleting the source data or sending the sheet to someone else, so formulas do not break.
  • Use the Evaluate Formula tool (Formulas > Evaluate Formula) to step through a result you do not understand.

Troubleshooting

If every row returns "No match" even though the data looks identical, suspect data type or hidden characters first. Compare lengths with =LEN(A2) and =LEN(B2): if they differ, there is whitespace. If lengths match but values still fail, try =EXACT(A2,B2) to test for case, and check for a stray apostrophe at the start of a number.

If you see #N/A from a lookup, the value genuinely is not in the lookup range, or the range is wrong. If you see #REF!, the column index number points outside the range. If you see #SPILL!, the formula is trying to output several cells but something is in the way; clear the cells below or beside it. If you see #VALUE!, a cell in the calculated range contains text where a number is expected.

If the conditional formatting highlights everything, check whether one of the selected columns contains blanks or repeated header text; blanks often register as duplicates. If nothing highlights when it should, confirm both columns are included in the selection and that the formatting rule applies to the whole range.

If results stop updating after you edit a list, press F9 to recalculate, or check Formulas > Calculation Options and make sure it is set to Automatic rather than Manual. If the file was shared from another system, recheck the ranges — imported sheets sometimes carry hidden rows that were excluded from a copied range.

If a lookup returns the wrong matching row, the second list probably contains duplicates, so use COUNTIF to confirm and decide which record should win before trusting the result. If the whole workbook misbehaves, save a copy, close and reopen Excel, and test the formulas on a fresh sheet before rebuilding anything more drastic.

Frequently Asked Questions

How do I find values that are in one column but not the other?

Use =IF(COUNTIF($B$2:$B$100,A2)=0,"Missing from B","") and fill down, then filter for the non-blank results. Run the reverse version to catch values missing from A.

Why does Excel say two identical-looking values do not match?

Almost always whitespace, a non-breaking space, or a number stored as text. Use TRIM, SUBSTITUTE with CHAR(160), and convert to a consistent data type before comparing.

Can I match data that is on a different sheet or workbook?

Yes. Reference the other sheet as Sheet2!$A$2:$A$100, and for a different workbook include the file name in square brackets. Keep the other workbook open or the formula will show cached values or an error.

Does a match have to be case-sensitive?

Not by default. The equals sign and COUNTIF ignore case; use EXACT if "apple" and "Apple" must be treated as different.

What is the difference between a same-row comparison and a list check?

A same-row comparison asks whether row 2 in column A equals row 2 in column B. A list check asks whether the value appears anywhere in the other list. They answer different questions and use different formulas.

Can I highlight only the rows that match?

Yes, with Home > Conditional Formatting > New Rule > Use a formula to determine which cells to format, entering a rule such as =COUNTIF($B$2:$B$100,$A2)>0 and applying it to your data range.