Function Problems

How to Find Matching Numbers in Two Excel Cells

Khadija KhanKhadija Khan Oct 20, 2026 871 views

Question details

The user needs to compare two comma-separated lists contained within two different cells and extract the exact numbers that appear in both lists.

How to Find Matching Numbers in Two Excel Cells
Product
Excel
Device & OS
not provided
Scenario
Comparing two cells containing lists of numbers to find their intersection or common values without returning false partial matches.
Observed behavior
A combined comma-separated list of matching values is returned, ensuring that numbers are matched as complete units (e.g., matching 12 but not incorrectly matching it inside 112).
Before you start

Ensure your Excel version supports Dynamic Array functions like TEXTSPLIT and FILTER, which are generally available in Excel 365 and Excel 2021. For older versions, the Power Query method is recommended.

Solution 1Recommended

Use a Dynamic Array Formula to Find Matches

Use the LET, TEXTSPLIT, and FILTER functions to split the lists, compare the values, and find exact matching numbers.

This method involves splitting the text string in the first cell into an array and using the SEARCH function to see if those numbers exist in the second cell. Commas are added around the search strings to guarantee that only whole numbers are matched.

1
Select the destination cell

Click on an empty cell where you want the matching numbers to appear (e.g., cell B2).

2
Enter the comparison formula

Assuming your lists are in cells A2 and C2, enter the following formula: =LET(a,TEXTSPLIT(A2,","),TEXTJOIN(",",TRUE,FILTER(a,ISNUMBER(SEARCH(","&a&",",","&C2&",")),"")))

3
Execute the formula

Press Enter. The formula will instantly split the text, search for exact number matches, and join the common values into a single comma-separated text string.

Use a Dynamic Array Formula to Find Matches
Exact Match Assurance: Adding commas in the SEARCH string prevents partial matches, ensuring that the number '12' won't incorrectly trigger a match inside '112'.
Advanced Spreadsheet Tool

Compare and Find Matching Data in WPS Office

WPS Spreadsheet offers powerful data processing capabilities, including advanced text functions and dynamic arrays. You can easily compare lists and extract matching values with the same familiar formulas.

  1. 1. Open your dataset: Launch WPS Office and open the spreadsheet containing the comma-separated data lists.
  2. 2. Select a target cell: Click on a blank cell next to your lists where you want the intersection to be displayed.
  3. 3. Apply the formula: Input the combined TEXTSPLIT and FILTER formula to identify the identical values across the cells.
  4. 4. Generate matches: Press Enter to instantly generate a comma-separated list of perfectly matched numbers.
Supports modern dynamic array functions like TEXTSPLIT and FILTER.Fully compatible with Microsoft Excel file formats (.xlsx).Lightweight, fast, and completely free to use.Intuitive tabbed interface to manage multiple workbooks effortlessly.
microsoft office alternative - wps office

Frequently Asked Questions

Why does my formula return a #NAME? error?

The #NAME? error usually occurs if you are using an older version of Excel that does not support modern dynamic array functions like TEXTSPLIT or LET. Consider upgrading your Office version or use the Power Query method instead.

Can I compare cells separated by spaces instead of commas?

Yes, you can easily modify the delimiter in the formula. Replace the comma (",") with a space (" ") in both the TEXTSPLIT arguments and the SEARCH concatenation arguments.

How do I highlight matching numbers instead of extracting them into a new cell?

If your numbers are in individual cells rather than comma-separated lists, you can use Conditional Formatting. Select your range, choose 'Highlight Cells Rules' > 'Duplicate Values', and the software will color-code numbers that appear in both ranges.