How to return multiple values using vlookup in excel
The VLOOKUP function is designed to return only the corresponding value of the first instance of a lookup value. But there is a work-around to identify multiple matches.
Array formula in C8:
=VLOOKUP($B$8, INDEX(tbl, SMALL(IF($B$8=INDEX(tbl, , 1), ROW(tbl)-MIN(ROW(tbl))+1, ""), ROW(1:1)), , 1), 2, FALSE) + CTRL + SHIFT + ENTER copied down as far as needed.
Alternative array formula in C8:
=INDEX($C$2:$C$6, SMALL(IF($B$8=$B$2:$B$6, ROW($B$2:$B$6)-MIN(ROW($B$2:$B$6))+1, ""), ROW(A1))) + CTRL + SHIFT + ENTER. Copy cell and paste it down as far as needed.
I recommend using the alternative array formula. Although VLOOKUP is not used in the formula, it is easier to understand and troubleshoot.
Explaining the alternative array formula
Step 1
=INDEX($C$2:$C$6, SMALL(IF($B$8=$B$2:$B$6, ROW($B$2:$B$6)-MIN(ROW($B$2:$B$6))+1, ""), ROW(A1)))
In cells $B$2:$B$6 we want to identify cells equal to cell $B$8.
$B$8=$B$2:$B$6
becomes
"Pen"={"Pen", "Eraser", "Paper", "Pen", "Paper Clip"}
becomes
{"Pen"="Pen", "Pen"="Eraser", "Pen"="Paper", "Pen"="Pen", "Pen"="Paper Clip"}
$B$8=$B$2:$B$6 returns an array containing TRUE and/or FALSE.
In this example: (TRUE, FALSE, FALSE, TRUE, FALSE)
=INDEX($C$2:$C$6, SMALL(IF((TRUE, FALSE, FALSE, TRUE, FALSE), ROW($B$2:$B$6)-MIN(ROW($B$2:$B$6))+1, ""), ROW(A1)))
Step 2
=INDEX($C$2:$C$6, SMALL(IF($B$8=$B$2:$B$6, ROW($B$2:$B$6)-MIN(ROW($B$2:$B$6))+1, ""), ROW(A1)))
This part of the formula creates an array containing numbers from one to as many rows cell range $B$2:$B$6 have.
$B$2 - Row number 1
$B$3 - Row number 2
$B$4 - Row number 3
$B$5 - Row number 4
$B$6 - Row number 5
ROW($B$2:$B$6)-MIN(ROW($B$2:$B$6))+1 returns this array: (1,2,3,4,5)
=INDEX($C$2:$C$6, SMALL(IF((TRUE, FALSE, FALSE, TRUE, FALSE),(1,2,3,4,5) , ""), ROW(A1)))
Step 3
=INDEX($C$2:$C$6, SMALL(IF($B$8=$B$2:$B$6, ROW($B$2:$B$6)-MIN(ROW($B$2:$B$6))+1, ""), ROW(A1)))
Each cell in $B$2:$B$6 equal to $B$8 returns a row number.
IF($B$8=$B$2:$B$6, ROW($B$2:$B$6)-MIN(ROW($B$2:$B$6))+1, "") returns (1,"","",4,"")
=INDEX($C$2:$C$6, SMALL((1,"","",4,""), ROW(A1)))
Step 4
=INDEX($C$2:$C$6, SMALL(IF($B$8=$B$2:$B$6, ROW($B$2:$B$6)-MIN(ROW($B$2:$B$6))+1, ""), ROW(A1)))
This part of the formula returns the k-th smallest number in the array (1,"","",4,"")
To calcualte the k-th smallest value I am using ROW(A1) to create the number 1.
When the formula in C8 is copied to cell C9, ROW(A1) changes to ROW(A2). ROW(A2) is 2.
In Cell C8: =INDEX($C$2:$C$6, SMALL((1,"","",4,""), ROW(A1)))
=INDEX($C$2:$C$6, SMALL((1,"","",4,""), 1))
The smallest number in array (1,"","",4,"") is 1.
In Cell C9: =INDEX($C$2:$C$6, SMALL((1,"","",4,""), ROW(A2)))
=INDEX($C$2:$C$6, SMALL((1,"","",4,""), 2))
The second smallest number in array (1,"","",4,"") is 4.
Step 5
=INDEX($C$2:$C$6,1) is $1,50
=INDEX($C$2:$C$6,4) is $1,70
INDEX(array,row_num,[column_num])
Returns a value or reference of the cell at the intersection of a particular row and column, in a given range
Named ranges
tbl (B2:C6)
What is named ranges?
Download excel file for this tutorial.
Vlookup.xls
(Excel 97-2003 Workbook *.xls)
Functions in this article:
VLOOKUP(lookup_value; table_array; col_index_num; [range_lookup])
Looks for a value in the leftmost column of a table, and then returns a value in the same row from a column you specify. By default, the table must be sorted in ascending order.
IF(logical_test;[value_if:true];[value_if_false])
Checks whether a condition is met, and returns one value if TRUE, and another value if FALSE
SMALL(array,k) returns the k-th smallest row number in this data set.
INDEX(array,row_num,[column_num])
Returns a value or reference of the cell at the intersection of a particular row and column, in a given range
MIN(number1,[number2])
Returns the smallest number in a set of values. Ignores logical values and text
ROW(reference) returns the rownumber of a reference
Read more articles about this topic:
- Using array formula to look up multiple values in a list
- Search for multiple text strings in multiple cells in excel
Ream more Excel – Search/Lookup
Related posts:
- Vlookup with 2 or more lookup criteria and return multiple matches in excel
- Lookup a value in a list and return multiple matches in excel
- Vlookup of three columns to pull a single record
- Match two criteria and return multiple rows in excel
- Return multiple values if above frequency criterion in excel
- Return multiple values if in range in excel
- Lookup values in a range using two or more criteria and return multiple matches in excel
- Lookup values in a range using two or more criteria and return multiple matches in excel, part 2
- Sum adjacent values using multiple lookup text values in a column in excel
- Explaining a formula: Lookup values in a range using two or more criteria and return multiple matches in excel



November 13th, 2009 at 8:56 pm
Ok - I absolutely MUST comment on this! I've spent my entire day looking all over the web for help on doing a VLOOKUP to look up one value and return multiple corresponding values and have not found anything that has helped me as much as you have! =D You've made my day. Thank you for posting this!
~kenbra
November 14th, 2009 at 8:56 am
I am happy you found this post, but my advice is to take a look at this post instead: Using array formula to look up multiple values in a list. It has an array formula not as complicated as this one.
Thank you for your comment!
February 10th, 2010 at 5:34 am
Hi. I used this formula and it works great. However I like to know how the formulas I use work. I have spent a lot of time on the internet trying to break it down but this one has me stumped. I understand part, like the VLOOKUP and INDEX but I don't know how the rest fits in. Are you able to break this down for the dummies? If you have time it would be greatly appreciated.
July 15th, 2010 at 6:13 pm
Hi,
Continuing your example, is there a way to "Eraser" and "Paper clip"? and keep goign down? It returns #NUM because Row is set to 3:3 after the two Pen entries. Is there a way to reset the row to ROW(1:1) after a new vlookup search string?
Thanks
July 15th, 2010 at 10:27 pm
Excel User,
I am not sure I understand but I think I covered your question in this post: http://www.get-digital-help.com/2009/12/29/vlookup-with-2-or-more-lookup-criteria-and-return-multiple-matches-in-excel/