Author: Oscar Cronquist Article last updated on April 14, 2021 Show
The VLOOKUP function is designed to return only a corresponding value of the first instance of a lookup value, from a column you choose. But there is a workaround to identify multiple matches. The array formulas demonstrated below are smaller and easier to understand and troubleshoot than the useful VLOOKUP function. However you are not limited to array formulas, Excel also has built-in features that work very well, you will be amazed at how easy it is to filter values in a data set. Table of ContentsI have made a formula, demonstrated in a separate article, that allows you to VLOOKUP and return multiple values across worksheets, there is also an Add-In that makes it even easier to accomplish this task. Now, if you only need one instance of each returned value then check this article out: Vlookup – Return multiple unique distinct values It lets you specify a condition and the formula is not even an array formula. I have also written an article about searching for a string (wildcard search) and return corresponding values, it requires a somewhat more complicated formula but don't worry, you will find an explanation there, as well. Did you know that it is also possible to VLOOKUP and return multiple values distributed over several columns, the formula even ignores blanks. 1. VLOOKUP - Return multiple values verticallyCan VLOOKUP return multiple values? It can, however the formula would become huge if it needs to contain the VLOOKUP function. The formula presented here does not contain that function, however, it is more versatile and smaller. The image above shows you an array formula that extracts adjacent values based on a lookup value in cell D10. Another great thing with this array formula is that it allows you to lookup and return values from whatever column you like contrary to the VLOOKUP function that lets you only do a lookup in the left-most column, in a given range. Update 17 December 2020, check out the new FILTER function available for Excel 365 users. Regular formula in cell D10: =FILTER(C3:C7, B10=B3:B$7) Read here about how it works: Filter values based on a condition The following formula is for earlier Excel versions. Array formula in D10: =INDEX($C$3:$C$7, SMALL(IF(($B$10=$B$3:$B$7), MATCH(ROW($B$3:$B$7), ROW($B$3:$B$7)), ""),ROWS($A$1:A1))) This video explains how to VLOOKUP and return multiple matching values: The array formula in cell G3 looks in column B for "France" and return adjacent values from column C. The array formula in cell G3 filters values unsorted, if you want to sort returning values alphabetically, read this: Vlookup with 2 or more lookup criteria and return multiple matches How to create an array formula
Read moreHow to enter an array formula | Convert array formula to a regular formula | How to enter array formulas in merged cells Back to top The array formula above filters only values with one condition, the following article explains how to filter based on multiple criteria: Vlookup with 2 or more lookup criteria and return multiple matches If you don't like array formulas, try this regular but more complicated formula in cell D10: =INDEX($C$3:$C$7,SMALL(INDEX(($B$10=$B$3:$B$7)*(MATCH(ROW($B$3:$B$7), ROW($B$3:$B$7)))+($E$3<>$B$3:$B$7)*1048577,),ROWS($A$1:A1))) Back to top Explaining array formula (Return values vertically)You can easily follow along as I explain the formula, select cell D10. Go to tab "Formulas" on the ribbon and press with left mouse button on "Evaluate Formula" button. Press with left mouse button on "Evaluate" button shown above to move to next step. Step 1 - Identify cells equal to the condition in cell B10
|
lookup_value | Required. |
table_array | Required. A cell reference to the data table you want to search. |
col_index_num | Required. A number representing the column in the table_array. |
[h] | Optional. Return values horizontally. |
Array formula in cell C14:D14:
=vbaVlookup(B14, $B$2:$C$6, 2, "h")
How to enter custom function array formula
- Select cell range C9:C11
- Type above custom function
- Press and hold Ctrl + Shift
- Press Enter once
- Release all keys
Recommended articles
Back to top
How to enter custom function array formula
- Select cell range C14:D14
- Type above custom function
- Press and hold Ctrl + Shift
- Press Enter once
- Release all keys
How to copy array formula to the next row
- Select cell range C14:D14
- Copy cell range
- Select cell range C15:D15
- Paste
Vba code
- Copy vba code below.
- Press Alt + F11 to open the visual basic editor.
- Press with right mouse button on on your workbook in the project explorer.
- Press with mouse on "Insert".
- Press with mouse on "Module".
- Paste code to code module.
- Exit vb editor and return to Microsoft Excel
Recommended reading
Back to top
Back to top