russianmax
russianmax

Reputation: 177

Google Sheets vlookup for multiple results

Trying to find a vlookup formula that will return all of the matches not just the first on in the list. I have used the following formula

=VLOOKUP(A2,C:D,2,0)

I'm sure there's a way to do this I just haven't been able to figure this out on my own.

Results that I need vs what I get

enter image description here

Upvotes: 1

Views: 2310

Answers (1)

Kin Siang
Kin Siang

Reputation: 2699

Vlookup will always return the first occurrence value, therefore you will not be able to extract 2nd or 3rd value. One of the simple method to obtain nth return is to use index function together with filter as following:

=INDEX(FILTER(A:B,A:A=D2),COUNTIF($D$2:D2,D2),2) 

The countif will return 1st, 2nd or 3rd row after filtering the main table:

enter image description here

Upvotes: 4

Related Questions