View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
T. Valko T. Valko is offline
external usenet poster
 
Posts: 15,768
Default lookup to bring back multiple values

Try this...

Data in the range A2:B20

D1 = lookup name
E1 = formula to count how many records meet the condition

=COUNTIF(A2:A20,D1)

Array entered** in D2 and copied down until you get blanks:

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

If your data is sorted so that the names are grouped together it's much
simpler.

--
Biff
Microsoft Excel MVP


"zakfalls" wrote in message
...
Almost gives me what i need...i can work with this,

Thanks


"Mike H" wrote:

Hi,

With your lookup name in E1 try this array formula. Put the formula in a
cell and drag down. When it starts producing #NUM errors then you have
found
every occurrence of your lookup value

=INDEX($B$1:$B$1000,LARGE(($A$1:$A$1000=$E$1)*ROW( $A$1:$A$1000),COUNTIF($A$1:$A$1000,$E$1)+1-ROW(A1)))

This is an array formula which must be entered by pressing
CTRL+Shift+Enter
'and not just Enter. If you do it correctly then Excel will put curly
brackets
'around the formula {}. You can't type these yourself. If you edit the
formula
'you must enter it again with CTRL+Shift+Enter.

Mike

"zakfalls" wrote:

Hi,

I have a sheet with various names in column A with attributes in col B,
the
names can occur more than once. a normal vlookup will only bring back
the
first value in col B which i know. but i want to bring back all the
different
result in column b for a name which occurs more than once.

I know this invloves Arrays, but the eg ive seen is set up in a way
where
the name you are looking is on the first line, and amending it does not
really work for me.

Does anyone have any suggestion or a better example of how to do this?

hope ive made this clear!!!

Cheers



 
ExcelBanter Database Error
Database Error Database error
The ExcelBanter database has encountered a problem.

Please try the following:
  • Load the page again by clicking the Refresh button in your web browser.
  • Open the www.excelbanter.com home page, then try to open another page.
  • Click the Back button to try another link.
The www.excelbanter.com forum technical staff have been notified of the error, though you may contact them if the problem persists.
 
We apologise for any inconvenience.