Google Sheets vlookup for multiple results

Viewed 961

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

1 Answers

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

Related