Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default Help Please - Lookup in an array that has duplicte values

I have an array with the lead column having duplicate ID #'s, but unique
related data in the array. I need to lookup all related data to the ID. In
the following example, I need to lookup ID #2 and find both Blue and Green.
Is this possible?

ID Color
1 Red
2 Blue
2 Green
3 Black

--
Bryan
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8,520
Default Help Please - Lookup in an array that has duplicte values

With the query ID in Cell C1 enter the below array formula in cell C2 and
copy down as required

Col A Col B Col C
ID Color 2
1 Red =formula
2 Blue
2 Green
3 Black


=IF(COUNTIF($A$1:$A$100,C1)<ROW(A1),"",INDEX(B$1:B $100,
SMALL(IF($A$1:$A$100=C1,ROW($A$1:$A$100)),ROW(A1)) ))

Please note that this is an array formula. You create array formulas in the
same way that you create other formulas, except you press CTRL+SHIFT+ENTER to
enter the formula. If successful in 'Formula Bar' you can notice the curly
braces at both ends like "{=<formula}"


If this post helps click Yes
---------------
Jacob Skaria


"CBI FlexCard" wrote:

I have an array with the lead column having duplicate ID #'s, but unique
related data in the array. I need to lookup all related data to the ID. In
the following example, I need to lookup ID #2 and find both Blue and Green.
Is this possible?

ID Color
1 Red
2 Blue
2 Green
3 Black

--
Bryan

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default Help Please - Lookup in an array that has duplicte values

Try this...

Defined names:

ID refers to: =$A$2:$A$5
Color refers to: =$B:$B

D2 = lookup ID = 2

Enter this formula in E2. This will return the count of lookup ID's.

=COUNTIF(ID,D2)

Enter this array formula** in D3 and copy down until you get blanks:

=IF(ROWS(D$3:D3)E$2,"",INDEX(Color,SMALL(IF(ID=D$ 2,ROW(ID)),ROWS(D$3:D3))))

** array formulas need to be entered using the key combination of
CTRL,SHIFT,ENTER (not just ENTER). Hold down both the CTRL key and the SHIFT
key then hit ENTER.

--
Biff
Microsoft Excel MVP


"CBI FlexCard" wrote in message
...
I have an array with the lead column having duplicate ID #'s, but unique
related data in the array. I need to lookup all related data to the ID.
In
the following example, I need to lookup ID #2 and find both Blue and
Green.
Is this possible?

ID Color
1 Red
2 Blue
2 Green
3 Black

--
Bryan



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Use array for lookup value, to return array of lookups Glen Excel Discussion (Misc queries) 3 May 7th 09 11:55 PM
Table Lookup formula where 2 known values are inside array excel-lookuper New Users to Excel 3 May 25th 07 05:49 AM
Array: Counting multiple values within array Trilux_nogo Excel Worksheet Functions 4 April 16th 07 03:12 AM
lookup a list of values for an array formula Xbrokylnboy Excel Worksheet Functions 0 June 19th 06 08:12 PM
find maximum of two values in an array with same lookup value Andy M Excel Discussion (Misc queries) 5 May 13th 05 01:31 PM


All times are GMT +1. The time now is 12:53 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"