Formula Errors

How to Use INDEX and MATCH for Duplicate Values in Excel

Khadija KhanKhadija Khan Nov 3, 2026 869 views

Question details

The user needs to retrieve multiple different records associated with a duplicated lookup value instead of getting the same result repeatedly.

How to Use INDEX and MATCH for Duplicate Values in Excel
Product
Excel
Device & OS
not provided
Scenario
Looking up data in a spreadsheet where the search key (like a code or ID) appears multiple times in the source dataset.
Observed behavior
Standard INDEX and MATCH or VLOOKUP formulas repeatedly return only the first matching record, failing to retrieve subsequent unique entries for the duplicated code.
Before you start

Ensure your data ranges are accurate and structured properly. Consider converting your dataset into a Table, which makes handling complex formulas easier to read and manage.

Solution 1Recommended

Use an Array Formula with SMALL, IF, ROW, and COUNTIF

Use a complex array formula to dynamically count occurrences and return the 1st, 2nd, and 3rd match as you drag the formula down the column.

Standard lookup formulas stop at the first match. To bypass this, you can combine INDEX with SMALL, IF, ROW, and COUNTIF to force the formula to look for the next occurrence corresponding to the row you are currently filling.

1
Select the destination cell

Click on the cell where you want to output the first instance of your duplicated value.

2
Enter the array formula

Type the formula: =IFERROR(INDEX($B$4:$E$13,SMALL(IF($B$4:$B$13=$G4,ROW($B$4:$B$13)-ROW($B$3)),COUNTIF($G$4:G4,$G4)),MATCH(H$3,$B$3:$E$3,0)),""). Ensure you adjust the cell references to match your actual data layout.

3
Apply as an Array Formula

Instead of just pressing Enter, press Ctrl + Shift + Enter to evaluate it as an array formula. Curly braces {} will appear around your formula in the formula bar.

4
Drag the formula down

Use the fill handle at the bottom right corner of the cell to drag the formula down. The COUNTIF function will increment automatically, pulling the 2nd, 3rd, and subsequent matches.

Use an Array Formula with SMALL, IF, ROW, and COUNTIF
Absolute References: Pay close attention to the dollar signs ($) in the formula. Absolute referencing is crucial for the ranges to remain fixed while you drag the formula down.
Professional Spreadsheet Tool

Handle Complex Lookups Seamlessly with WPS Spreadsheet

WPS Office provides full support for advanced array formulas, helper columns, and dynamic functions. You can easily manage duplicates and process complex datasets with an interface identical to Microsoft Excel.

  1. 1. Open your dataset: Launch WPS Spreadsheet and open the document containing the duplicate values you want to process.
  2. 2. Input the array formula: Select the target cell and enter your INDEX, SMALL, IF, and MATCH combination.
  3. 3. Execute the array: Press Ctrl + Shift + Enter to correctly process the array calculation and retrieve your exact duplicate match.
  4. 4. Apply to multiple rows: Drag the fill handle to effortlessly populate the rest of your ticket numbers or costs.
100% compatible with Microsoft Excel formulas and formattingSeamlessly executes complex INDEX, MATCH, and array functionsFree, lightweight, and incredibly fast for large datasetsFamiliar user interface with zero learning curve
QA img-9

Frequently Asked Questions

Why does VLOOKUP or INDEX and MATCH only return the first value?

By design, standard lookup functions in spreadsheet software search from the top down and immediately stop searching as soon as they find the first exact match for your criteria.

Do I always need to press Ctrl+Shift+Enter for these formulas?

If you are using the complex SMALL(IF()) array combination in traditional versions of Excel or WPS Spreadsheet, you must use Ctrl+Shift+Enter. Modern dynamic array updates handle this natively, but the shortcut ensures backward compatibility.

Is there an easier function to return multiple matching records?

Yes. If you have a newer version of Excel or WPS Office that supports dynamic arrays, you can use the FILTER function to easily extract all matching records based on your criteria without using complex INDEX and MATCH combinations.