Excel: Find Matches in Two Columns
In this article
To find matches between two columns in Excel, the quickest reliable method is a formula in a helper column: with your first list in column A and the second in column B, enter =IF(COUNTIF(B:B,A2)>0,"Match","No match") in C2 and fill it down beside list A. Every cell that says "Match" has a counterpart somewhere in column B; "No match" means column A has an entry column B lacks. Modern Excel builds can also use =IF(ISNUMBER(XMATCH(A2,B:B)),"Match","No match"), and Excel 365 can use =ISNUMBER(XMATCH(A2:A100,B2:B100)) to spill a whole result column at once. If you would rather see the answer visually than in text, conditional formatting or the Duplicate Values dialog can highlight the overlaps instead.
Formulas are usually the best answer because they leave a clean audit trail: you can see exactly which row was checked and why it came back as it did, and you can sort or filter the results afterwards. The methods below assume both lists sit on the same worksheet, but the same formulas work across sheets by prefixing the range with the sheet name, for example Sheet2!B:B.
What You'll Need
- Excel for Windows, Excel for Mac, or Excel on the web. The COUNTIF method works in every version; XMATCH needs a newer build.
- Two columns of data on the same worksheet (or a workbook with the second list on another sheet).
- One empty column directly beside your first list for the results.
- Ideally, clean data: no leading or trailing spaces, consistent capitalisation, and no numbers stored as text in one list and as numbers in the other.
Menu names and ribbon locations can differ slightly by Excel version, platform and region, so if a button is not exactly where described, look for the same wording elsewhere on the ribbon.
Step-by-Step
- Set up a helper column. Click the header of the column immediately to the right of your first list (column C if list one is in A and list two is in B) and type a label such as Match check in row 1.
- Write the match formula in the first data row. In C2, type
=IF(COUNTIF(B:B,A2)>0,"Match","No match")and press Enter. ReplaceB:Bwith whatever column holds your second list. If your second list is a fixed block rather than a whole column, use an absolute range such as$B$2:$B$500so it does not shift when you copy it. - Fill the formula down. Select C2, then double-click the small square at the bottom-right corner of the selection (the fill handle) to copy the formula down to the last row of column A. Alternatively, drag the fill handle or copy C2 and paste it into the rest of the column.
- Read the results. "Match" means that row's value exists somewhere in the second list. "No match" means it does not. Because COUNTIF ignores case, Apple and apple count as a match by design.
- Optionally check the reverse direction. Matching one way only tells you what list one is missing from list two. To find entries in column B that are absent from column A, put
=IF(COUNTIF(A:A,B2)>0,"Match","No match")in D2 and fill down. Running both directions is how you spot differences rather than just overlaps. - Filter to the rows you care about. Select the header row, then use Data > Filter, and filter the helper column to "No match" to see only the unmatched entries. This is often faster than scrolling a long list.
- Prefer the modern function if you have it. In Excel 365 or Excel 2021 and later,
=XMATCH(A2,B:B)returns the position of the match instead of forcing you to wrap COUNTIF in an IF. Wrapped inISNUMBER, it also gives a clean TRUE/FALSE. From a single cell you can write=ISNUMBER(XMATCH(A2:A100,B2:B100))and Excel spills the whole column of results, provided there is empty space below. - Highlight matches instead, if you want a visual. Select your first list, go to Home > Conditional Formatting > New Rule > Use a formula to determine which cells to format, and enter
=COUNTIF($B$2:$B$500,$A2)>0. Choose a fill colour and confirm. Matched cells light up in place, which is handy for scanning but harder to audit than a formula column. - Use the built-in duplicate check for one-off comparisons. Selecting two adjacent columns and using Home > Conditional Formatting > Highlight Cells Rules > Duplicate Values highlights values that appear in both columns. It only works cleanly when the two lists sit side by side and treats the selection as one block, so the formula method is more flexible.
- Tidy up when you are done. Once you have read or exported the results, delete the helper column if you do not need it, or copy the whole column and use Paste Special > Values to replace the formulas with plain text before sending the file to anyone else.
Common Mistakes
The single most common cause of a false "No match" is invisible whitespace. If one list was pasted from a website or exported from another system, cells may carry leading or trailing spaces. Wrap the lookup value in TRIM, as in =IF(COUNTIF(B:B,TRIM(A2))>0,"Match","No match"), and clean the reference list the same way first.
Number-versus-text mismatches are the second culprit. An ID that looks identical can be stored as text in one column and as a number in the other, so COUNTIF and XMATCH both fail to see it. Look for a green triangle warning at the corner of the cell, or select the column and use Data > Text to Columns > Finish to coerce it into a consistent type. Converting the whole column to text with a helper formula is another reliable fix.
Using a relative range when you meant an absolute one is a quiet error: B2:B500 in C2 becomes B3:B501 in C3, so rows near the bottom start comparing against the wrong window. Anchor it with dollar signs.
Lastly, partial matches are misunderstood. COUNTIF with a plain value looks for that value within cells, but wildcards behave differently depending on the argument. If you need exact whole-cell matching rather than "contains", test with =IF(ISNUMBER(XMATCH(A2,B:B,0)),"Match","No match") or use exact-match COUNTIF carefully, and blank out stray wildcard characters such as asterisks and question marks in your data.
Tips
- Keep the results column immediately beside the list being checked so the relationship is obvious to anyone opening the file.
- Use a whole-column reference such as
B:Bfor growing lists; it recalculates automatically as new rows are added, at the cost of a little speed on very large workbooks. - Add a second helper column that counts occurrences with
=COUNTIF(B:B,A2)when you need to know how many times a value appears, not just whether it appears. - Use
XLOOKUPorVLOOKUPwhen you need to pull a related value across, such as a price or a name, rather than just confirming a match exists. - If you compare the same two lists repeatedly, put them in an Excel Table (Insert > Table). Formulas written against structured references grow with the table and stop needing manual fill-down.
- Save a copy before running Text to Columns or any bulk data cleaning, since those changes are not easy to undo once you have saved the file.
Troubleshooting
Everything says "No match" when you can see identical values. Check for spaces with TRIM, check data types, and check that your second-list range actually points at the column you think it does. Press Ctrl+` (or the equivalent on Mac) to show formulas on the sheet and inspect the range references.
Only some rows are wrong. That usually points to a range that shifts as you fill down, or to a handful of dirty cells. Sort the helper column so "No match" sits together, then inspect the first few problem rows side by side.
The formula shows a #NAME? error. XMATCH is not available in your version of Excel. Fall back to the COUNTIF method, which works everywhere.
Results are stale. If calculation is set to manual (Formulas > Calculation Options), press F9 to recalculate, or switch back to automatic.
Excel is slow with whole-column references. Narrow the range to the actual data block, anchor it with dollar signs, and avoid running thousands of COUNTIF calls against an entire column in a very large workbook.
Frequently Asked Questions
How do I find matches between two columns in different sheets?
Point the COUNTIF range at the other sheet with its name, for example =IF(COUNTIF(Sheet2!B:B,A2)>0,"Match","No match"). If the sheet name contains spaces, wrap it in single quotes, as in 'Second List'!B:B.
Does COUNTIF treat upper and lower case differently?
No. COUNTIF is case-insensitive, so Apple and apple are treated as the same value. If you need a case-sensitive comparison, use the EXACT function with SUMPRODUCT or an array formula instead.
Can I find values that appear in both lists only once?
Yes. Compare the COUNTIF result for each column: an entry that appears once in each list has a count of 1 on both sides, while duplicates will show a higher count in at least one. A helper column showing the count makes this easy to filter.
What is the difference between finding matches and finding duplicates?
Finding matches compares two separate lists and tells you which values overlap. Finding duplicates looks for repeats within a single list or selection. The formula approach here compares lists; the Duplicate Values conditional formatting rule does both depending on what you select.
Why does XMATCH return a number instead of "Match"?
XMATCH returns the position of the found value by default. Wrapping it in ISNUMBER converts that to TRUE or FALSE, which you can then turn into text with an IF statement if you prefer readable labels.
Can I count how many values match between the two columns?
Yes. A formula such as =SUMPRODUCT(--ISNUMBER(XMATCH(A2:A100,B2:B100))) returns the number of entries in the first list that also appear in the second, which is useful for a quick summary figure.