View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
ALEX ALEX is offline
external usenet poster
 
Posts: 493
Default Getting more than one lookup results in array

For T.Valko

I've just seen your solution of the problem and I'm going to try it as soon
as possible. The biggest problem is that I have experience with sql and php
but I'm
rather new in Excel and, to be honest, don't know how to create a drop down
list in Excel. I know that something like drop down list is automatically
created when filtering data...

"T. Valko" wrote:

Here's another one.

Assume your data is in the range A2:B5.

Try this array formula** :

=IF(ROWS($1:1)<=COUNTIF(B$2:B$5,"excellent"),INDEX (A$2:A$5,SMALL(IF(B$2:B$5="excellent",ROW(B$2:B$5)-MIN(ROW(B$2:B$5))+1),ROWS($1:1))),"")

Copy down until you get blanks.

You can make this more dynamic (like having a dynamic filter) by doing this:

Create a drop down list in a cell of the different scores. Say this drop
down list in cell D2. In cell E2 enter a formula that counts how many of the
selected scores are present:

=COUNTIF(B2:B5,D2)

Then you can refer to those cells in the formula instead of having those
processes written directly into the formula. This makes the formula a little
bit shorter, more efficient and more dynamic (still an array formula**):

=IF(ROWS($1:1)<=E$2,INDEX(A$2:A$5,SMALL(IF(B$2:B$5 =D$2,ROW(B$2:B$5)-MIN(ROW(B$2:B$5))+1),ROWS($1:1))),"")

Here's a small sample file that demonstrates this:

http://cjoint.com/?hrx56jnYdZ

** array formulas need to be entered using the key combination of
CTRL,SHIFT,ENTER (not just ENTER)

--
Biff
Microsoft Excel MVP


"Alex" wrote in message
...
I've tried several functions alone and combined with the next problem, but
nothing work correctly.
Suppose I have two columns A i B - first with the personal names and
second
with some score written in text: excellent, very good, good. I want to
find
oll "excellent" in B column and write down all personal names in
corresponding A column cells.
For example:
A B
Tom excellent
Beky good
Mike excellent
Jerry very good

I want too lookup for ALL excellent in B column and write down (list) in
another column (for instnance column F) all personal names with score
"excellent" - in this particular example:
F
Tom
Mike

It's very important to me and I'm searching through Excell Help for days
and
can't find the solution....

Thanks