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.
Are you still looking for help with the VLOOKUP function? View our comprehensive round-up of VLOOKUP function tutorials here.
Leave a Comment