Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

VLOOKUP 2nd Value: Return the Next Match in Excel

· 6 min read · Home Tech

In this article
  1. Why VLOOKUP returns only the first match
  2. Use a helper column to get the second match
  3. Use FILTER for a direct second-result formula
  4. Choose the method that fits the data
  5. Common errors and details to check
  6. Frequently Asked Questions

To return the second matching value with VLOOKUP in Excel for Microsoft 365, use a helper column that numbers repeated matches, then look up the number 2. VLOOKUP returns the first match it finds; it has no built-in option for “second match.” If you want the second matching result without a helper column, FILTER is usually simpler.

Why VLOOKUP returns only the first match

VLOOKUP searches the first column of a table from top to bottom and returns a value from a specified column in the same row. With an exact-match lookup, it stops at the first row that matches the lookup value. For example, if a product appears three times in a list, an ordinary VLOOKUP returns the value from the first occurrence, not the second.

This behavior is useful when the lookup key is unique, such as an employee ID. It becomes a limitation when the key repeats and the rows represent separate transactions, dates, or records. “Second value” can also mean two different things: the value in the second column of the first matching row, or the result from the second matching row. VLOOKUP can return a value from its second table column by using column index 2; finding the second matching row requires a different method.

Use a helper column to get the second match

A helper column can assign each occurrence of a key a sequence number. The lookup then searches for the key combined with occurrence number 2. This works in older Excel versions as well as Microsoft 365, and it makes the matching logic visible.

Assume the data is in A2:B6, with item names in column A and associated results in column B. Put a header in C1 such as Occurrence. In C2, enter this formula and fill it down through C6:

=COUNTIF($A$2:A2,A2)

For each row, the formula counts how many times its value in column A has appeared from the first data row through the current row. If A2:A6 contains “Pen,” “Book,” “Pen,” “Pen,” and “Book,” the occurrence numbers in C2:C6 are 1, 1, 2, 3, and 2.

With the source data in A2:C6 and occurrence numbers in column C, enter the item to search for in E2 and the desired occurrence number in F2. Use this formula to return the associated value from column B:

=VLOOKUP(E2&F2,CHOOSE({1,2},$A$2:$A$6&$C$2:$C$6,$B$2:$B$6),2,FALSE)

For example, if E2 contains Pen and F2 contains 2, the formula returns the value in column B on the second Pen row. The constructed search key is Pen2, so the first and second occurrences are distinguishable. In current Microsoft 365, this formula can be entered normally. In some older Excel versions, formulas that build arrays may require Ctrl+Shift+Enter rather than Enter.

The last argument, FALSE, requests an exact match. Keep it for this use: omitting it or using TRUE can produce an approximate result when the lookup data is not sorted appropriately. If there is no second occurrence, the formula returns #N/A.

Use FILTER for a direct second-result formula

In Microsoft 365, FILTER can return all rows that meet a condition, and INDEX can select the second result. This avoids making a helper column. Suppose names are in A2:A20 and their associated values are in B2:B20. With the name to find in E2, use:

=INDEX(FILTER(B2:B20,A2:A20=E2),2)

If the matching name appears at least twice, the formula returns the value from column B for its second matching row, preserving the order of the source data. For example, if “Pen” appears in rows 2, 6, and 9, it returns the value from B6. If there are fewer than two matches, INDEX returns an error because there is no second item in the filtered result.

To show a friendly message when there is no second match, wrap the formula in IFERROR:

=IFERROR(INDEX(FILTER(B2:B20,A2:A20=E2),2),"No second match")

FILTER is available in Microsoft 365 and Excel 2021 or later. It is not available in older perpetual versions such as Excel 2019. In Excel for the web, these dynamic-array functions are supported; Mac users with Microsoft 365 can use the same formulas, though ribbon and shortcut details may differ.

Choose the method that fits the data

  • Use a helper column when you need a method compatible with older Excel versions, want to inspect occurrence numbers, or will look up several occurrence positions.
  • Use FILTER with INDEX for a compact formula in Microsoft 365 or Excel 2021 and later, especially when the source data changes regularly.
  • Use XLOOKUP when you want the last match rather than the second. XLOOKUP can search from last to first, but it does not directly select an arbitrary second occurrence.
  • Use a PivotTable or another summary when the real goal is to analyze repeated records rather than retrieve one particular row.

Both methods above return a value from the same row as the match. If you need several columns from that second row, use FILTER on the entire return range—for example, a multi-column range—or adjust the helper-column lookup range and column index. Be mindful that VLOOKUP can only return columns to the right of its lookup column; if your desired result is to the left, use INDEX and MATCH, XLOOKUP, or FILTER instead.

Common errors and details to check

Check the following when the result is unexpected:

  • What counts as “second”? The helper-column approach and FILTER return matches in worksheet row order. Sorting the source data can change which record is second.
  • Are the keys truly identical? Extra spaces, different punctuation, or numbers stored as text can prevent a match. Check and standardize the source values if necessary.
  • Is the occurrence counter filled down? Each row needs its own running COUNTIF formula. A fixed range that counts the entire column will assign the same total to every repeated key.
  • Are ranges aligned? In FILTER, the condition range and return range must cover corresponding rows and have compatible dimensions.
  • Are there enough matches? A second-result formula cannot return a second match if only one matching row exists. Use IFERROR if a readable fallback is preferable to #N/A or another error.

For a case-sensitive match, the formulas above are not sufficient: standard VLOOKUP and the equality test used by FILTER are not case-sensitive. A separate approach using EXACT may be needed. Also, duplicates are not necessarily mistakes; they may represent valid separate records, so avoid deleting them simply to make a lookup return a result.

Frequently Asked Questions

Can VLOOKUP return the second match by itself?
No. VLOOKUP returns the first match it finds. To retrieve a later matching row, create a distinct lookup key with an occurrence number or use a function such as FILTER with INDEX.

How do I return the second column with VLOOKUP?
If you mean the second column of the first matching row, use 2 as VLOOKUP’s column index. For example, with the lookup column first and the result column second in the table, the structure is =VLOOKUP(E2,A2:B20,2,FALSE). This is different from returning the second matching row.

How do I get the third or fourth match?
With the helper-column method, replace the occurrence number in F2 with 3 or 4. With FILTER and INDEX, replace the 2 in the formula with the position you need, such as 3 for the third matching result.

What if I need the second matching row, not just one value?
In Microsoft 365, FILTER can return every matching row as a spilled array; select the second row of that result with INDEX when you only want that row. A helper-key approach can also identify the occurrence, after which you can retrieve each required field.

Does XLOOKUP return the second match?
Not directly. XLOOKUP can search from the last item toward the first, which is helpful for the last match, but it does not offer a setting to choose the second occurrence. FILTER with INDEX or an occurrence-number helper is more suitable.