Excel VLOOKUP to Return Multiple Values Vertically

One of the most amazing and widely used functions of Excel is the VLOOKUP function. So far we have learned to pull out a single match from a range of cells using the VLOOKUP function. In this article, I’ll show you how to return multiple values vertically from a range of cells using the VLOOKUP function in Excel.

Read more: VLOOKUP to Return Multiple Columns in Excel


Download Practice Workbook


How to Return Multiple Values Vertically Using VLOOKUP in Excel

Here we’ve got a data set with the Book Types, Book Names, and Authors of some books of a bookshop called Martin Bookstore.

Data Set to Return Multiple Values Vertically Using VLOOKUP in Excel

Today our objective is to lookup for a specific value and return all the values based on a specific match using the VLOOKUP function of Excel.

Step 1:

  • Select a new column left to the first column of your data set.
  • Enter the following formula in the first cell:
=C4&COUNTIF(C4:$C$13,C4)

[Here C4 and C13 are respectively the first and last cells of my first column. You use your one.]

Creating New Column to Return Multiple Matches in Excel

Step 2:

  • Then drag the Fill Handle up to the last cell.
  • This will generate a series of Book Types along with their serial numbers. Like Novel1, Novel2, etc…

Dragging the Fill Handle in Excel to Return Multiple Values in Excel

Step 3:

  • Now, go to another new column.
  • Put the name of the Book Type that you want to look up as the Column Header.

Selecting the Column to Return Multiple Matches in Excel

Step 4:

  • Enter this formula in the first cell of the column:
=VLOOKUP(G3&ROW(A1:INDIRECT("A"&COUNTIF(C4:C13,G3))),B4:E13,3,FALSE)
  • Here G3 is the Column Header of the Book Type (Novel).
  • C4:C13 is the first column of my data set (Book Type)
  • B4:B13 is the whole data set, along with the extra column right in front of the Book Type column.
  • 3 is the column number of the data that we want to extract (Book Name in this example) considering the extra column.
  • It is an Array Formula. So don’t forget to select multiple cells earlier and press CTRL+SHIFT+ENTER unless you are in Office 365.

VLOOKUP Function to Return Multiple Matches in Excel

See, we have got all the books of the type “Novel”.

You can repeat the same procedure for Poetry, Autobiography, or Non-Fiction. Just change the Column Header from “Novel” to your desired one.

Note:

  • This method has one limitation. That is, it exhibits the multiple matches in reverse order.
  • It displays the last novel “The Forty Rules of Love” first, the first novel “A Tale of Two Cities” last, and so on.

Explanation of the Formula

  • COUNTIF(C4:C13,G3) tells how many cells in the range C4:C13 (Book Type) contain the value in cell G3 (Novel).
  • In simple words, how many novels there are in total. It is 4. See the COUNTIF function for details.
  • INDIRECT("A"&COUNTIF(C4:C13,G3)) becomes INDIRECT("A"&4) and returns the cell reference A4. See the INDIRECT function for details.
  • ROW(A1:INDIRECT("A"&COUNTIF(C4:C13,G3)))now becomes ROW(A1:A4).
  • It returns an array from 1 to 7, {1, 2, 3, 4}.  See the ROW function for details.
  • G3&ROW(A1:INDIRECT("A"&COUNTIF(C4:C13,G3)))now concatenates the value in cell G3 (Novel) with the array returned by the ROW function. So it returns another array {Novel1, Novel2, Novel3, Novel4}.
  • Finally, VLOOKUP(G3&ROW(A1:INDIRECT("A"&COUNTIF(C4:C13,G3))),B4:B13,3,FALSE) becomes VLOOKUP({Novel1, Novel2, ..., Novel7},B4:E13,3,FALSE).
  • It searches for each value of the array {Novel1, Novel2, …, Novel4} in the lookup column B.
  • Then returns the corresponding Name of the novel from the 3rd column (Column_Index_Number is 3.)
  • Thus we get a list of all the novels.

Alternative Methods to the VLOOKUP to Return Multiple Values Vertically

1. Use FILTER Function to Return Multiple Values in the New Versions of Excel

The method described above is useful, yet a bit complex.

If you use the new version of Excel (or Office 365), you can accomplish the same task using only a single function, the FILTER function.

The formula to find out all the books of type “Novel” will be:

=FILTER(C4:C13,B4:B13=F3)
  • Here C4:C13 is the column from which I want to extract data (Book Name).
  • B4:B13 is the first column of my data set (Book Type).
  • And F3 is the Column Header containing the type of book I want to extract (Novel).

FILTER Function to Return Multiple Values Vertically

See, we have got all the books of the type “Novel”.

You can repeat the same procedure for Poetry, Autobiography, or Non-Fiction. Just change the Column Header from “Novel” to your desired one.


2. Combine IFERROR, INDEX, SMALL, ROW, and ROWS Function for Older Versions of Excel

If you’re using the older version of Excel, can apply the VLOOKUP function described earlier in this article.

But that method has one limitation. It exhibits the multiple names in reverse order.

To exhibit the multiple matches in the original order in the old versions of Excel, you can use a complex formula consisting of the IFERROR function, INDEX function, SMALL function, ROW function, and ROWS function of Excel.

The formula to get all the books of type novel in the data set, the formula will be:

=IFERROR(INDEX(B4:D13,SMALL(IF(B4:B13=F3,(ROW(B4:B13)-ROWS(B1:B3)),""),(ROW(B4:B13)-ROWS(B1:B3))),2),"")
  • Here, B4:D13 is my data set.
  • B4:B13 is the first column of my data set.
  • F3 is the Column Header containing the Book Type (Novel).
  • B1:B3 is the cells of my first column before the data set starts.
  • It is an Array Formula. So don’t forget to select multiple cells beforehand and press CTRL+SHIFT+ENTER unless you are in Office 365.

Return Multiple Values in Excel for Older Versions

See, we have got all the books of the type “Novel”.

You can repeat the same procedure for Poetry, Autobiography, or Non-Fiction. Just change the Column Header from “Novel” to your desired one.


Conclusion

Using these methods, you can return multiple values vertically from a range of cells using the VLOOKUP function of Excel, or in some alternative ways. Do you know any other method? Or do you have any questions? Feel free to ask us.


Related Readings

Rifat Hassan

Hello! Welcome to my profile. Here I will be posting articles related to Microsoft Excel. I am a passionate Electrical Engineer holding a Bachelor’s degree in Electrical and Electronic Engineering from Bangladesh University of Engineering and Technology. Besides academic studies, I always love to keep pace with the revolution in technology that the world is rushing towards day by day. I am diligent, career-oriented, and ready to cherish knowledge throughout my life.

We will be happy to hear your thoughts

Leave a reply

ExcelDemy
Logo