Index Match data to provide multiple results in columns

lomond44

New Member
Joined
May 6, 2014
Messages
7
I need some help with a spreadsheet that contains 2 worksheets.

The first sheet contains part numbers and the assemblies that they are used in. Each part number can be used in many assemblies.

On the 2nd sheet is a list of just the part numbers without duplicates. The aim is to create columns to the right of each part number that identifies all the assemblies that the part is used in.

I have looked at this link How To Return Multiple Match Values in Excel Using INDEX-MATCH or VLOOKUP | eImagine Technology Group but I do not want the results to be down a column but to go across the row.

Any help appreciated :)
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
Are you saying that DDD should not peered with A as well as with B?


Yes , that would be an ideal solution.

Sheet2, A:B, houses the target companies with the associated market caps...

Row\Col
A​
B​
1​
CompanyMarket Cap
2​
AAA
170000​
3​
BBB
20000​
4​
CCC
40000​
5​
DDD
2000​
6​
EEE
30000​
7​
FFF
1000​
8​
GGG
60000​
9​
HHH
70000​
10​
III
19000​
11​
JJJ
29000​
12​
KKK
30000​

<tbody>
</tbody>


Select A2:A12, name the selection Tcompanies (from target companies) via the Name Box or Formulas | Name Manager.

In the same way, select B2:B12 and name the selection Tmcaps.

Define Ivec using Formulas | Name Manager as referring to:
Rich (BB code):

=ROW(Tcompanies)-ROW(INDEX(Tcompanies,1,1))+1

Sheet1, where the processing takes place...

Row\Col
A​
B​
C​
D​
E​
F​
G​
H​
I​
1​
CompanyMkt.Cap
30%
-30%
Peer companies
2​
A
10000​
13000​
7000​
3​
B
20000​
26000​
14000​
BBBIII
4​
C
130000​
169000​
91000​
5​
D
20000​
26000​
14000​
6​
E
50000​
65000​
35000​
CCCGGG
7​
F
30000​
39000​
21000​
EEEJJJKKK
8​
G
40000​
52000​
28000​

E2, control+shift+enter, not just enter, copy across, and down:
Rich (BB code):

=IFERROR(INDEX(Tcompanies,SMALL(IF(FREQUENCY(IF(Tmcaps>=$D2,
   IF(Tmcaps<=$C2,IF(Tcompanies<>"",
   IF(COUNTIFS($E$1:INDEX($E$1:$Z1,0,ROWS(Tcompanies)),Tcompanies)=0,
   MATCH(Tcompanies,Tcompanies,0))))),Ivec),Ivec),COLUMNS($E2:E2))),"")
 
Upvote 0
Hi Aladin, I apologize for hijacking this thread but I have a very similar issue and would be extremely grateful if you pointed me in the right direction.

I have a large database on a shared network, and another workbook which acts as a GUI of sorts for inputting information. I am trying to figure out a way to create a searchbox which will pull relevant information from the database and present it on the GUI. I learned a little VBA making this, but am a novice when it comes to excel formulas. From what I understand this is possible with a similar formula (or the same) as what you have posted in this thread. The information on the database looks like

Client | Contact | Title | Phone # | Cell # | Email | Address | City | State | Zip | Country | Remarks
Microsoft | Bill gates | CEO | xxx-xxx-xxx | xxx-xxx-xxx| xxx@xxx.com |(Address)|(city)|(State)| (Zip) | (country) | (remarks)
ect
ect
ect
ect


The term to search with would be "client" and "contact" (changed with option button). There are duplicate results for many of the search terms, I need them all to display. I have dynamic named ranges in the database I want the formulas to reference. Any advice would be deeply appreciated.

Thanks
 
Last edited:
Upvote 0
Sheet2, A:B, houses the target companies with the associated market caps...

Row\Col
A​
B​
1​
CompanyMarket Cap
2​
AAA
170000​
3​
BBB
20000​
4​
CCC
40000​
5​
DDD
2000​
6​
EEE
30000​
7​
FFF
1000​
8​
GGG
60000​
9​
HHH
70000​
10​
III
19000​
11​
JJJ
29000​
12​
KKK
30000​

<tbody>
</tbody>


Select A2:A12, name the selection Tcompanies (from target companies) via the Name Box or Formulas | Name Manager.

In the same way, select B2:B12 and name the selection Tmcaps.

Define Ivec using Formulas | Name Manager as referring to:
Rich (BB code):

=ROW(Tcompanies)-ROW(INDEX(Tcompanies,1,1))+1

Sheet1, where the processing takes place...

Row\Col
A​
B​
C​
D​
E​
F​
G​
H​
I​
1​
CompanyMkt.Cap
30%
-30%
Peer companies
2​
A
10000​
13000​
7000​
3​
B
20000​
26000​
14000​
BBBIII
4​
C
130000​
169000​
91000​
5​
D
20000​
26000​
14000​
6​
E
50000​
65000​
35000​
CCCGGG
7​
F
30000​
39000​
21000​
EEEJJJKKK
8​
G
40000​
52000​
28000​

<tbody>
</tbody>


E2, control+shift+enter, not just enter, copy across, and down:
Rich (BB code):

=IFERROR(INDEX(Tcompanies,SMALL(IF(FREQUENCY(IF(Tmcaps>=$D2,
   IF(Tmcaps<=$C2,IF(Tcompanies<>"",
   IF(COUNTIFS($E$1:INDEX($E$1:$Z1,0,ROWS(Tcompanies)),Tcompanies)=0,
   MATCH(Tcompanies,Tcompanies,0))))),Ivec),Ivec),COLUMNS($E2:E2))),"")

Thanks a ton. Though it dint come out as I expected initially, I managed to play with it to reach some steps closer than where I initially was. But could you please elaborate on Ivec? Could not find much online either. Is it something that you just defined or is it a function of excel?
 
Upvote 0
Thanks a ton. Though it dint come out as I expected initially, I managed to play with it to reach some steps closer than where I initially was. But could you please elaborate on Ivec? Could not find much online either. Is it something that you just defined or is it a function of excel?

Did you run the instructions as given for your rather vague feedback implies that it doesn't somehow fit what you have specified?
 
Upvote 0
Hello,

I hope you still watch this thread Aladin. You are amazing.
I want to ask you something which is related with the first example in first page.
Is there a way to search in a array without using the exact string?

eg. if I use "Mous" instead of "Mouse" for the lookup word, I want to get the same results: Mickey and Minnie

It would be great if you had an answer for this.
 
Upvote 0
Hello,

I hope you still watch this thread Aladin. You are amazing.
I want to ask you something which is related with the first example in first page.
Is there a way to search in a array without using the exact string?

eg. if I use "Mous" instead of "Mouse" for the lookup word, I want to get the same results: Mickey and Minnie

It would be great if you had an answer for this.

Care to specify which formula are you referring to?
 
Upvote 0
Yes, the code is in your post #4.
I am trying to replace the "$A$2:$A$8=$D2"part of your code with a search function like SEARCH($D2,$A$2:$A$8).

Of course I wouldn't mind if you know a way to do it without the SEARCH function
;)

My goal is to make this to work without using the exact string in D2.

 
Upvote 0
Yes, the code is in your post #4.
I am trying to replace the "$A$2:$A$8=$D2"part of your code with a search function like SEARCH($D2,$A$2:$A$8).

Of course I wouldn't mind if you know a way to do it without the SEARCH function
;)

My goal is to make this to work without using the exact string in D2.


Some options...
Rich (BB code):

=IFERROR(INDEX($B$2:$B$8,SMALL(IF(ISNUMBER(SEARCH($D2,$A$2:$A$8)),
  ROW($B$2:$B$8)-ROW($D$2)+1),  COLUMNS($E2:E2))),"")

=IFERROR(INDEX($B$2:$B$8,SMALL(IF(LEFT($A$2:$A$8,LEN($D2))=$D2,
  ROW($B$2:$B$8)-ROW($D$2)+1),  COLUMNS($E2:E2))),"")<strike>
</strike>

Does one of these help?
 
Upvote 0
Hello Aladin,

The first code did the job for me.
The only problem is that if you have an empty cell for a "lookup" word, it returns all cells as true. I guess this is happening because SEARCH function finds " " in all my data and always returns TRUE.
But I am fine with this. I can fill the "lookup column" with some special characters and avoid empty cells.
Anyway, great job as always. Thank you very much.

For the record, the second code does not work if your lookup string does not start with the string in the search array.
e.g. "Mou" will return the expected results Mickey, Minnie but "ous" or "use" will not return anything
 
Upvote 0

Forum statistics

Threads
1,216,126
Messages
6,129,005
Members
449,480
Latest member
yesitisasport

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top