How to Return the Second Match or Nth Value in Excel
Question details
The user needs to look up and return the second matching value in a ranked dataset, rather than the first match typically returned by standard lookup functions.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Extracting the second-highest-ranked player for a specific position from a sports roster sorted by rank.
- Observed behavior
- Standard lookup functions like VLOOKUP or XLOOKUP only return the very first matching record encountered in the dataset.
Ensure your dataset is correctly sorted by rank or your preferred criteria before applying these formulas, as the order of the extracted results depends entirely on the source data's sorting order.
Use INDEX and FILTER to Find the Nth Match
This is the most efficient and straightforward method for modern versions of Excel and WPS Spreadsheet that support dynamic array functions.
By combining the FILTER function with the INDEX function, you can first isolate all matching records and then extract a specific instance, such as the second or third occurrence.
Click on the empty cell where you want the second-highest-ranked player's name to appear.
Type the FILTER function to extract all players matching your criteria. For example: FILTER(C2:C100, B2:B100="SS"), where column C holds names and column B holds positions.
Enclose your FILTER formula within an INDEX function and specify the row number as 2 to get the second match. The final formula will look like: =INDEX(FILTER(C2:C100, B2:B100="SS"), 2).
Press Enter to execute the formula. The cell will now display the second matching record from your sorted list.

Use an INDEX and AGGREGATE Formula for Older Versions
If you are using an older version of Excel that does not support the FILTER function, you can use a combination of INDEX and AGGREGATE.
Easily Extract Nth Matching Values in WPS Spreadsheet
WPS Office fully supports dynamic array functions like FILTER, INDEX, and SEQUENCE, allowing you to easily look up second, third, or any Nth matching values in your datasets. It provides a seamless experience for advanced data manipulation.
- 1. Open your dataset in WPS: Launch WPS Spreadsheet and open your existing workbook containing the ranked data.
- 2. Input the dynamic formula: Select an empty cell and type =INDEX(FILTER(return_range, criteria_range="condition"), 2).
- 3. Get instant results: Press Enter to instantly view the second matching record without needing complex array keystrokes.

Frequently Asked Questions
Can I use VLOOKUP to return the second match in Excel?
Standard VLOOKUP only returns the first matching instance it finds. To return the second match with VLOOKUP, you would need to create a helper column that combines your lookup value with a count (e.g., "SS2"). Using INDEX and FILTER is the recommended modern alternative.
What happens if there is no second match in my data?
If there is no second match, the INDEX function will return a #REF! error because the filtered array doesn't have a second row. You can wrap your formula in the IFERROR function to handle this gracefully, like this: =IFERROR(INDEX(FILTER(...), 2), "Not Found").
How do I return the third or fourth match?
You simply need to change the row number argument at the end of the INDEX function. For the third match, change the 2 to a 3: =INDEX(FILTER(range, criteria), 3). For the fourth, change it to a 4, and so on.




