Go Back

How to Get the nth Match with VLOOKUP in Excel

We can get the nth match of a data with the VLOOKUP function. This can help us to organize data so that if we are looking for a value, it will be displayed. The steps below will walk through the process.

Figure 1: Result of the nth match with VLOOKUP

General formula

=VLOOKUP(id_formula,table,4,0)

Formula

=VLOOKUP(id&"-"&I6,data,4,0)

Setting up The Data

We will input the data as shown in figure 2 into the respective columns and cells.

Figure 2: Setting up the data to get the nth match with VLOOKUP

Setting up the Helper Column

  • We will click on Cell B4
  • We will insert the formula below into Cell B4

=D4&"-"&COUNTIF($D$4:D4,D4)

  • We will click on enter

Figure 3: Setting up the Helper Column to get the nth match with VLOOKUP

  • We will use the drop-down feature to complete the values for the helper column

Figure 4: Setting up the Helper Column to get the nth match with VLOOKUP

Finding the Nth Match

  • We will click on Cell J6
  • We will insert the formula below into Cell J6

=VLOOKUP(J3&"-"&I6,B4:G11,4,0)

Figure 5: Finding the nth match with VLOOKUP

  • We will click on enter

Figure 6: Finding the nth match with VLOOKUP

  • We will input the formula below into Cell J7 and repeat the steps

=VLOOKUP(J3&"-"&I7,B4:G11,4,0)

Figure 7: Result of the nth match with VLOOKUP

Explanation 

  • Helper Column

We use the helper column to construct an identity that includes the count. The formula we used to create the helper column from the steps builds a unique lookup value based on the worker ID and a counter that detects the number of times the unique ID has been displayed in the data table.

  • COUNTIF Function

The COUNTIF function is used to generate a running count of the ID in the data. For instance, Cell B4 and Cell B10 is an example of a running count.   

  • VLOOKUP Function

VLOOKUP is used for getting values from the table, taking into cognizance the “nth” occurrence.

Instant Connection to an Expert through our Excelchat Service

Most of the time, the problem you will need to solve will be more complex than a simple application of a formula or function. If you want to save hours of research and frustration, try our live Excelchat service! Our Excel Experts are available 24/7 to answer any Excel question you may have. We guarantee a connection within 30 seconds and a customized solution within 20 minutes.

Did this post not answer your question? Get a solution from connecting with the expert.

Another blog reader asked this question today on Excelchat:
Here are some problems that our users have asked and received explanations on

Working on fuzzy match with vlookup to get difference between two calculations. Unable to get proper calculation.
Solved by Z. E. in 22 mins
I need a formula to work with the large formula. I am finding the nth largest numbers and then using Vlookup to find a number in a cell next to this. I don't want it to just return duplicate numbers at the same nth degree if multiple same numbers
Solved by G. A. in 11 mins
cant get a index(match() or vlookup to work correctly
Solved by C. E. in 30 mins

Leave a Comment

avatar