Can I use in any way the vlookup function and return all matches if there are multiple values? I mean, it should return the values of all the matches, not just the first one...If VBA is the only way can anybody help me to get a code ? Thanks !
Can I use in any way the vlookup function and return all matches if there are multiple values? I mean, it should return the values of all the matches, not just the first one...If VBA is the only way can anybody help me to get a code ? Thanks !
This is possible to do, but not with VLOOKUP. With this kinda formula you can
=INDEX(ReturnRange,SMALL(IF(SearchValue=ValuesRange,ROW(INDIRECT("1:"&ROWS(ValuesRange)))),ROW(A1)))
Confirm it with Ctrl+Shift+Enter and copy down.
Here used named ranges.
SearchValue is J1
ValuesRange = A1:A50
ReturnRange = B1:B50
Also, if you copy this formula down in 15 cell but you have only 7 matches, all other cell will be filled with #NUM! errors.
To avoid this error"
If you use 2007 ucan wrap this formula in IFERROR function... ie
=IFERROR(Formula,"")
If you use earlier version of excel you can wrap it into:
1: =IF(ISERROR(Formula),"",Formula)
2: =LOOKUP(REPT("Z",255),CHOOSE({1,2},"",Formula) ' This will work if ALL your outputs are TEXT
3: =LOOKUP(99^99,CHOOSE({1,2},0,Formula) ' This will work if ALL your outputs are NUMBERS
Last edited by contaminated; 06-19-2010 at 02:41 PM.
Люди, питающие благие намерения, как раз и становятся чудовищами.
Regards, ?Born in USSR?
Vusal M Dadashev
Baku, Azerbaijan
id avoid that and go for an index match with a helper but it depends on how big your data is
"Unless otherwise stated all my comments are directed at OP"
Mojito connoisseur and now happily retired
where does code go ?
look here
how to insert code
how to enter array formula
why use -- in sumproduct
recommended reading
wiki Mojito
how to say no convincingly
most important thing you need
Martin Wilson: SPV
and RSMBC
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks