ExcelReady
CourseMock testsFunction guidesBlog
Start freeStart learning for free
ExcelReady

Be Excel-ready before day one. Hands-on practice in your browser, with instant feedback.

Learn

  • Course
  • Mock tests
  • Function guides
  • Blog

Test prep

  • Excel level test
  • Excel test practice
  • Free screening quiz
  • Certificate

Company

  • About
  • Editorial policy
  • Contact
  • Terms
  • Privacy

© 2026 ExcelReady. All rights reserved.

  1. Blog
  2. Lookups
  3. VLOOKUP Second Match: Return the Nth Occurrence in Excel

VLOOKUP Second Match: Return the Nth Occurrence in Excel

By ExcelReady Team·Updated November 2, 2026·6 min read

The short answer

VLOOKUP always returns the first match, so it can't return the second one by itself. In Excel 2021 or Microsoft 365, use =INDEX(FILTER(C2:C8,A2:A8="Lena"),2) to get the second match. In any version, add a helper column that numbers each occurrence with COUNTIF, such as Lena-2, and look that key up with VLOOKUP.

Key takeaways

  • VLOOKUP, XLOOKUP and MATCH stop at the first match they find, so the second match needs a different method.
  • In Excel 2021 or Microsoft 365, =INDEX(FILTER(results, lookup_range=value), n) returns the nth match.
  • In any version, a helper column with =B2&"-"&COUNTIF($B$2:B2,B2) gives keys like Lena-2 that VLOOKUP can find.
  • Wrap the formula in IFERROR to show a message when there is no second match.
On this page+
  1. Why VLOOKUP only returns the first match
  2. How to return the second match with INDEX and FILTER
  3. How to return the nth match from a cell
  4. VLOOKUP second match with a COUNTIF helper column
  5. Nth match in older Excel without a helper column
  6. Return all the matches instead
  7. Practise it

A VLOOKUP second match is not something VLOOKUP can return on its own: it always stops at the first row that matches. To get the second match, or the third, or any nth match, you either list every match with FILTER and pick one with INDEX, or give each repeat its own key in a helper column. This guide shows both, plus a no-helper formula for older Excel.

Why VLOOKUP only returns the first match#

VLOOKUP searches the first column from the top and stops as soon as it finds the value. Everything below that row is ignored. XLOOKUP and MATCH work the same way. That is fine for unique IDs, but not for a customer who appears on several orders.

All the examples use this order list in A1:C8:

ABC
1CustomerProductAmount
2LenaChair120
3OmarDesk85
4LenaLamp64
5PriyaShelf210
6LenaRug99
7OmarMat40
8PriyaStool75

=VLOOKUP("Lena",A2:C8,3,FALSE) returns 120, Lena's first order. Her second order, the Lamp for 64, is the one we want.

How to return the second match with INDEX and FILTER#

In Excel 2021 or Microsoft 365, combine FILTER and INDEX. FILTER returns every value that meets a condition, as a list. INDEX then picks one item from that list by its position:

Excel formula
=INDEX(FILTER(C2:C8,A2:A8="Lena"),2)
  1. FILTER(C2:C8,A2:A8="Lena") builds the list of Lena's amounts: 120, 64, 99.
  2. INDEX(...,2) takes the second item from that list.

The result is 64. Change the 2 to 3 and you get 99, the third match. To return the product name instead, filter column B: =INDEX(FILTER(B2:B8,A2:A8="Lena"),2) returns Lamp.

This is the cleanest method because it needs no extra columns and keeps working when rows are added. The FILTER function guide covers its arguments, and the Excel FILTER function article shows more conditions. The INDEX reference explains how the position number works.

How to return the nth match from a cell#

Put the name and the occurrence number in cells so one formula answers every question. With the customer in F1 and the number in G1:

Excel formula
=INDEX(FILTER(C2:C8,A2:A8=F1),G1)

If G1 is larger than the number of matches, INDEX returns #REF!. If the name has no matches at all, FILTER returns #CALC!. Wrap the formula in IFERROR to show a friendly message for both:

Excel formula
=IFERROR(INDEX(FILTER(C2:C8,A2:A8=F1),G1),"No such match")

To get the last match, whatever the count, use COUNTIF as the position: =INDEX(FILTER(C2:C8,A2:A8=F1),COUNTIF(A2:A8,F1)) returns 99 for Lena. XLOOKUP can also do this with search mode -1; see how to look up the last match.

VLOOKUP second match with a COUNTIF helper column#

In any version of Excel, you can make VLOOKUP find the second match by giving every row a unique key. The key joins the customer name with a running count: Lena-1, Lena-2, Lena-3.

VLOOKUP can only look to the right, so the key must be in the first column. Insert a new column A (right-click the column A header, then Insert). The data moves to columns B:D. In A2, type:

Excel formula
=B2&"-"&COUNTIF($B$2:B2,B2)

Fill it down to row 8 (Windows: Ctrl+D; Mac: ⌘D). The range $B$2:B2 is an expanding range: the start is locked with $, but the end moves down as you fill. So in row 4 it becomes $B$2:B4 and counts the second Lena, giving Lena-2.

A (helper)BCD
2Lena-1LenaChair120
3Omar-1OmarDesk85
4Lena-2LenaLamp64
5Priya-1PriyaShelf210
6Lena-3LenaRug99

Now VLOOKUP finds the second match with an exact-match lookup:

Excel formula
=VLOOKUP("Lena-2",A2:D8,4,FALSE)

The result is 64. With the name in F1 and the number in G1, use VLOOKUP(F1&"-"&G1,A2:D8,4,FALSE). The COUNTIF function guide explains the counting part. You can hide the helper column if you don't want people to see it.

Nth match in older Excel without a helper column#

If you can't use FILTER and don't want a helper column, INDEX with SMALL and IF finds the nth matching row:

Excel formula
=INDEX(C2:C8,SMALL(IF(A2:A8="Lena",ROW(A2:A8)-ROW(A2)+1),2))
  • ROW(A2:A8)-ROW(A2)+1 numbers the rows 1 to 7.
  • IF(A2:A8="Lena",...) keeps the numbers of Lena's rows: 1, 3 and 5.
  • SMALL(...,2) takes the second smallest: 3.
  • INDEX(C2:C8,3) returns 64.

In Excel 2019 and earlier this is an array formula: press Ctrl+Shift+Enter instead of Enter (Mac: ⌘+Shift+Return). In Microsoft 365 a normal Enter works. It's harder to read than FILTER, so use it only when you must. The INDEX MATCH guide covers the INDEX basics.

Return all the matches instead#

Sometimes you don't need the second match, you need every match. FILTER alone does that: =FILTER(B2:C8,A2:A8="Lena") spills all three of Lena's orders into the cells below. To show them in one cell, such as "Chair, Lamp, Rug", combine TEXTJOIN with FILTER. Both are covered in how to return multiple values from a lookup and how to list every match in one cell.

Two common mistakes to avoid:

  • Forgetting FALSE in VLOOKUP. Without it, VLOOKUP uses an approximate match and can return the wrong row.
  • Not locking the start of the COUNTIF range. COUNTIF(B2:B2,B2) filled down becomes B3:B3, B4:B4, so every key ends in -1.
  • Hidden spaces in the names. "Lena " with a trailing space is a different value from "Lena", so it gets its own count and FILTER skips it. Clean the column with TRIM before you look anything up.
  • Sorting after building the helper keys. The counts follow the row order. If you sort the data, the formulas recalculate, so "Lena-2" may now point at a different order. That is correct, but it surprises people who wrote the old answer down.

Practise it#

Repeat customers, duplicate employee names and multiple orders per ID all show up in job tests. Practise FILTER in a live spreadsheet: you type the formula and it checks it instantly. Then practise the building blocks in the INDEX MATCH lesson and the COUNTIF lesson, or try the exercise on this page first.

Try it yourself

This is a live spreadsheet. Type the formula in the green cell and press Enter.

Lena has three orders. In F2, return the Amount of Lena's second order: use FILTER to keep Lena's amounts (C2:C8 where A2:A8 equals F1), then INDEX to take item 2.

fx
ABCDEFG
1
Customer
Product
Amount
Customer
Lena
2
Lena
Chair
120
2nd amount
3
Omar
Desk
85
4
Lena
Lamp
64
5
Priya
Shelf
210
6
Lena
Rug
99
7
Omar
Mat
40
8
Priya
Stool
75
9
10
11

Tip: FILTER(C2:C8,A2:A8=F1) lists Lena's amounts. Put it inside INDEX and ask for row 2.

Practise this in a lesson

LessonFILTER: pull matching rows with a formulaReturn every row that meets one or more conditions with FILTER, and show a friendly message when nothing matches.LessonINDEX and MATCHCombine INDEX and MATCH to look up in any direction, including returning a column to the left of the one you search.LessonCOUNTIFCount the cells that match a condition, from exact words to number checks like ">=8".Function guideFILTERReturn every row that matches a condition with Excel's FILTER. Multiple criteria, empty results and #SPILL! explained, with live practice.Function guideINDEXLearn the Excel INDEX function: return a value by row and column position, build two-way lookups with MATCH, and practice live.Function guideCOUNTIFCount cells that match one condition with COUNTIF: text, numbers, wildcards and cell references. Real examples and a live exercise.

Frequently asked questions

How do I get VLOOKUP to return the second match?

+

VLOOKUP can't do it alone. Add a helper column that joins the lookup value with a running count, such as Lena-2, then use VLOOKUP to find Lena-2. In Excel 2021 or Microsoft 365, =INDEX(FILTER(C2:C8,A2:A8="Lena"),2) is quicker.

Can XLOOKUP return the second match?

+

Not directly. XLOOKUP can return the first match or, with search mode -1, the last match. For the second or any nth match, use INDEX with FILTER.

How do I return the nth match in Excel?

+

Put n in a cell, for example G1, and use =INDEX(FILTER(C2:C8,A2:A8=F1),G1). Change G1 to 3 to get the third match. Wrap it in IFERROR to handle values with fewer matches.

Why does my nth match formula return #REF!?

+

The value has fewer matches than the number you asked for, so INDEX points past the end of the list. If there are no matches at all, FILTER returns #CALC! instead. IFERROR can replace both with a message.

Sources

  • FILTER function - Microsoft Support
  • INDEX function - Microsoft Support
  • COUNTIF function - Microsoft Support

Written and checked by the ExcelReady Team. First published November 2, 2026. The practice exercise runs in the same formula engine as our lessons. Found a mistake? Read our editorial policy or email hello@excelready.app.

On this page

  1. Why VLOOKUP only returns the first match
  2. How to return the second match with INDEX and FILTER
  3. How to return the nth match from a cell
  4. VLOOKUP second match with a COUNTIF helper column
  5. Nth match in older Excel without a helper column
  6. Return all the matches instead
  7. Practise it

Keep reading

Lookups· 6 min read

Return Every Match for a Lookup in Excel (FILTER)

VLOOKUP and XLOOKUP stop at the first match. To return every match, use FILTER: =FILTER(B2:B7,A2:A7=F2) lists all the orders for the customer in F2, spilling one per row. Add a third argument such as "No orders" for when nothing matches, and wrap it in TEXTJOIN to put all matches in one cell. FILTER needs Excel 2021 or Microsoft 365.

Lookups· 7 min read

Find the Last Match in Excel With XLOOKUP

To find the last match, set XLOOKUP's sixth argument, search_mode, to -1 so it searches from the bottom up: =XLOOKUP(F2,A2:A8,C2:C8,"Not found",0,-1). It returns the value from the last row where column A equals F2, such as the most recent price in a list sorted oldest first. XLOOKUP needs Excel 2021 or Microsoft 365.

Dynamic arrays· 6 min read

The FILTER Function in Excel (With AND and OR)

FILTER returns every row of a range that passes a test: =FILTER(A2:C9,B2:B9="East"). The matching rows spill into the cells below and update when the data changes. For AND, multiply tests in brackets; for OR, add them. The third argument shows a message when nothing matches. FILTER needs Excel 2021, Excel 2024 or Microsoft 365.

More on lookups

  • VLOOKUP Between Two Sheets, Step by Step
  • VLOOKUP With Wildcards: Partial Match Lookups
  • XLOOKUP in Excel: Everything a Beginner Needs
  • XLOOKUP From Another Sheet or Workbook
  • XLOOKUP Approximate Match: Next Smaller or Larger
  • XLOOKUP If Not Found: Show a Message Instead of #N/A
All lookups articles →

Don't just read about Excel. Do it.

Practise real formulas in a live spreadsheet with instant feedback, right in your browser. Nothing to download.

Start learning for free