Retrieve nth match with VLOOKUP
Suppose you have a list of values and their corresponding information, to retrieve the related information of the nth match of a value, you can use a formula based on the VLOOKUP function.
How to retrieve information associated with the nth match of a value with VLOOKUP?
To use the VLOOKUP function to get the information about the 1st, 2nd, and 3rd matches of Pencil in the table as shown above, you should first add a helper column to the left of your table with a COUNTIF formula as shown below. The helper column joins the products with the number of times that the products showed up. Then you can easily get the corresponding quantities of the nth matched pencils.
Formula in cell A5: =B5&":"&COUNTIF($B$5:B5,B5).
Generic syntax
=VLOOKUP(lookup_value&":"&n,lookup_array,col_num,FALSE)
- lookup_value: The value you specified to lookup its nth match. Here refers to Pencil.
- n: Indicate the nth match. To find the 1st match of a value, set n as 1; to find the 2nd match, set n as 2.
- lookup_array: The range to retrieve the related information about the nth match from. Here refers to the whole data range including the helper column.
- col_num: The column number that indicates from which column of the lookup_array to return the information corresponding to the nth match from.
To get the information about the 1st match of Pencil, please copy or enter the formula below in the cell G7, and press Enter to get the result:
=VLOOKUP($F$4&":"&E7,$A$5:$C$11,3,FALSE)
√ Note: The dollar signs ($) above indicate absolute references, which means the lookup_value and lookup_array in the formula won't change when you move or copy the formula to other cells. However, there are no dollar signs added to the cell reference of n since you want it to be dynamic. After entering the formula, drag the fill handle down to apply the formula to the below cells.
Explanation of the formula
Here we use the formula below as an example:
=VLOOKUP($F$4&":"&E8,$A$5:$C$11,3,FALSE)
- The range_lookup FALSE asks the function to perform an exact match.
- The col_num 3 indicates that the matched value will be returned from the 3rd column of the range $A$5:$C$11.
- The snippet $F$4&":"&E8 indicates to lookup the 2nd (value in E8) match of Pencil (value in $F$4). In text form, the snippet is like this: Pencil:2.
- VLOOKUP now retrieves the corresponding quantity information from the 3rd column of the range $A$5:$C$11 that matches Pencil:2, which is 478.
Related functions
The Excel VLOOKUP function searches for a value by matching on the first column of a table and returns the corresponding value from a certain column in the same row.
Related Formulas
To find the nth match of a value from a range and retrieve its corresponding data, you can use a formula based on the INDEX, ROW, SMALL, and IF functions.
To find out the information listed in Excel about a specific product, movie or a person, etc., you should take advantage of the VLOOKUP function.
Retrieve information associated with lowest n values
To retrieve data that are corresponding to the smallest, 2nd smallest, or nth smallest value in a list, table or row in Excel, you can use an INDEX and MATCH formula together with the SMALL function.
There are times when you need Excel to retrieve data based on partial information. To solve the problem, you can use a VLOOKUP formula together with wildcard characters - the asterisk (*) and question mark (?).
The Best Office Productivity Tools
Kutools for Excel - Helps You To Stand Out From Crowd
Kutools for Excel Boasts Over 300 Features, Ensuring That What You Need is Just A Click Away...
Supports Office/Excel 2007-2021 and 365 | Available in 44 Languages | Easy to Uninstall Completely

Office Tab - Enable Tabbed Reading and Editing in Microsoft Office (include Excel)
- One second to switch between dozens of open documents!
- Reduce hundreds of mouse clicks for you every day, say goodbye to mouse hand.
- Increases your productivity by 50% when viewing and editing multiple documents.
- Brings Efficient Tabs to Office (include Excel), Just Like Chrome, Edge and Firefox.
