简体   繁体   中英

VLOOKUP to return multiple matches

I want to ask if there's a way/formula/vba to return multiple values when using vlookup? For example, I vlookup a data and when that data has multiple values to return, it will return the other values. Thanks.

For something as generic as this, just use Google.

Step #1)  www.google.com
Step #2)  get your answer in less time than it takes you to post here.

Return MULTIPLE corresponding values for ONE Lookup Value

The Excel VLOOKUP Function searches for a value (ie. Lookup_value) in the first column of a table array and returns a value in the same row from another column in the table array. In case of multiple occurrences of the Lookup value, the function searches the first occurrence of the Lookup value, and returns the corresponding value in the same row from another column.

In case you want to return multiple corresponding values, for the one Lookup value which has multiple occurrences, we show how it can be done using INDEX, SMALL, IF & ROW excel functions, as follows.

Consider the table array ("A2:B8"), in which you want to lookup the value "Apples" in column A which has multiple occurrences, and return all corresponding values in column B.

Enter the lookup value "Apples" in cell A11. In cell B11, enter below formula, as an array formula (CTRL+SHIFT+ENTER), and copy it downward in the same column B, in 7 rows (ie. number of times as the number of records in the table array "A2:B8". Multiple corresponding values (of the lookup value "Apples") will get copied vertically, starting from cell B11 till B17. Refer Table 1.

在此处输入图像描述

=INDEX($B$2:$B$8, SMALL(IF($A$11=$A$2:$A$8, ROW($A$2:$A$8)-ROW($A$2)+1), ROW(1:1)))

http://www.globaliconnect.com/excel/index.php?option=com_content&view=article&id=119:vlookup-multiple-values-return-multiple-corresponding-values-for-one-lookup-value&catid=77&Itemid=473

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM