How to Find the Row Number of a Duplicate Value in Excel
Question details
The user needs a method to identify the exact row number where a duplicate value appears in another column without causing performance issues.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Analyzing large datasets to locate the specific row of duplicated data between columns without triggering spreadsheet lag.
- Observed behavior
- Traditional lookup or full-column array calculations scan unnecessarily large ranges, resulting in slow and unresponsive Excel performance.
Ensure your dataset does not contain unintended blank rows or merged cells that might interfere with array formulas. For optimal performance, identify the approximate maximum row of your data (e.g., row 22000) to avoid referencing entire columns.
Use XMATCH to Find the Row Number Efficiently
The XMATCH function is highly optimized for performance and is the best choice for returning the exact cell reference of a duplicate value.
XMATCH performs a rapid lookup and, when combined with IFNA, provides a clean cell reference (like B20001) instead of an error when no duplicate is found.
Click on the empty cell where you want the duplicate's row location to be displayed.
Type the formula =IFNA("B"&XMATCH(A2, B1:B22000), ""), adjusting A2 to your target value and B1:B22000 to your actual data range in the target column.
Press Enter. The formula will return the column letter and matching row number. Drag the fill handle down to apply it to other cells.

Use MATCH and COUNTIF to Locate the First Duplicate
This combination finds the first instance of a duplicate between two columns in a defined range without requiring newer Excel functions.
Use FILTER and SEQUENCE to Extract All Duplicate Rows
If there are multiple duplicates and you need a complete list of their row numbers, the FILTER function combined with SEQUENCE generates a dynamic list.
Process Large Datasets smoothly with WPS Spreadsheet
WPS Spreadsheet is a powerful and lightweight tool equipped with an optimized calculation engine. It processes complex array formulas like XMATCH, MATCH, and FILTER rapidly, allowing you to locate duplicate row numbers in massive datasets without experiencing frustrating lag.
- 1. Install WPS Office: Download and install the free WPS Office suite on your computer.
- 2. Open your dataset: Launch WPS Spreadsheet and open your existing Excel workbook (.xlsx or .xls).
- 3. Apply duplicate formulas: Use the XMATCH or FILTER formulas in an empty column to locate your duplicate row numbers instantly.
- 4. Save your work: Save your spreadsheet with perfect format and formula retention.

Frequently Asked Questions
Why does referencing an entire column (like A:A) slow down my spreadsheet?
Referencing entire columns forces the calculation engine to process over a million rows (1,048,576). For resource-heavy functions like COUNTIF or array formulas, this exponentially increases calculation time. Always restrict your formula to defined data ranges (like A1:A22000) for better performance.
Does XMATCH work in older versions of Excel?
No, the XMATCH function is available only in Excel 365, Excel 2021, and newer versions (as well as WPS Spreadsheet). If you are using an older version of Excel, you will need to rely on the traditional MATCH function.
How can I visually highlight duplicate rows instead of finding their numbers?
You can use Conditional Formatting for a visual approach. Select your data range, navigate to the Home tab, click on Conditional Formatting > Highlight Cells Rules > Duplicate Values, and choose a preferred color format to highlight the duplicates.
What does the IFNA function do in the XMATCH formula?
IFNA handles the #N/A error that naturally occurs when XMATCH searches for a value but cannot find a duplicate. Instead of cluttering your spreadsheet with error codes, IFNA catches it and returns a blank cell string (""), keeping your data clean and readable.




