Help needed.

G

Gary

I posted this question earlier but this is a simplified version of it.

In column A I have employees' names, in column B I have Team Leaers' names.

Employee names will be unique in each cell but the team leaders names will
be repeated several times.

something like

Employee TL

John Robert
Kelly Robert
Michael Robert
Gary Daniel
Jerry Daniel
Jim Robert
Brian Robert
Richie Kevin
Pete Kevin
Alex Daniel


Now if I enter the Team Leader's name in another sheet's column A and drag
it down, I want the names of the employees (only the ones in his team) to
return in column B.

Possible?

Thanks.
 
T

T. Valko

Try this.

Sheet1 A2:A11 = employee names
Sheet1 B2:B11 = team leader names

Sheet2 A1 = any one of the team leaders names

Enter this array formula** in Sheet2 A2:

=IF(ROWS(A$2:A2)<=COUNTIF(Sheet1!B$2:B$11,A$1),INDEX(Sheet1!A$2:A$11,SMALL(IF(Sheet1!B$2:B$11=A$1,ROW(Sheet1!A$2:A$11)-MIN(ROW(Sheet1!A$2:A$11))+1),ROWS(A$2:A2))),"")

Copy down until you get blanks. You need to copy to enough cells that covers
the max number of employees for any single leader. For example, in your
sample Robert is listed the most, 5 times, so you need to copy the formula
to at least 5 cells.

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top