Skip to main content

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.

retrieve nth match with vlookup 1

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.

retrieve nth match with vlookup 2

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.

retrieve nth match with vlookup 3

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

Excel VLOOKUP function

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

Retrieve nth match with INDEX

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.

Exact match with VLOOKUP

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.

Partial match with VLOOKUP

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 AI Aide: Revolutionize data analysis based on: Intelligent Execution   |  Generate Code  |  Create Custom Formulas  |  Analyze Data and Generate Charts  |  Invoke Kutools Functions
Popular Features: Find, Highlight or Identify Duplicates  |  Delete Blank Rows  |  Combine Columns or Cells without Losing Data  |  Round without Formula ...
Super VLookup: Multiple Criteria  |  Multiple Value  |  Across Multi-Sheets  |  Fuzzy Lookup...
Adv. Drop-down List: Easy Drop Down List  |  Dependent Drop Down List  |  Multi-select Drop Down List...
Column Manager: Add a Specific Number of Columns  |  Move Columns  |  Toggle Visibility Status of Hidden Columns  Compare Columns to Select Same & Different Cells ...
Featured Features: Grid Focus  |  Design View  |  Big Formula Bar  |  Workbook & Sheet Manager | Resource Library (Auto Text)  |  Date Picker  |  Combine Worksheets  |  Encrypt/Decrypt Cells  |  Send Emails by List  |  Super Filter  |  Special Filter (filter bold/italic/strikethrough...) ...
Top 15 Toolsets12 Text Tools (Add Text, Remove Characters ...)  |  50+ Chart Types (Gantt Chart ...)  |  40+ Practical Formulas (Calculate age based on birthday ...)  |  19 Insertion Tools (Insert QR Code, Insert Picture from Path ...)  |  12 Conversion Tools (Numbers to Words, Currency Conversion ...)  |  7 Merge & Split Tools (Advanced Combine Rows, Split Excel Cells ...)  |  ... and more

Kutools for Excel Boasts Over 300 Features, Ensuring That What You Need is Just A Click Away...

Description


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.
Comments (0)
No ratings yet. Be the first to rate!
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations