Index Match with multiple results with a twist

michaeltsmith93

Board Regular
Joined
Sep 29, 2016
Messages
83
Hi, I'm trying to use INDEX, MATCH and SMALL to return multiple results and having some difficulty. On Sheet1, I have the following data:

StudyInvestigator
Study123Smith, John
Study123Smith, John
Study123Smith, John
Study456Smith, John
Study456Smith, John
Study123Doe, Jane
Study123Doe, Jane
Study123Doe, Jane
Study789Doe, Jane

<tbody>
</tbody>


On Sheet2, the investigator names are listed with last and first names in separate columns, so I concatenate that and add a comma and put that in Sheet 3 Row 1, as below. In the subsequent rows, I'd like the formula to spit out the studies in Sheet1 Column A. It would look like this:

Doe, JaneSmith, John
Study123Study123
Study123Study123
Study123Study123
Study789Study456
Study456

<tbody>
</tbody>


The formula that I have is: =IFERROR(INDEX(Sheet1!$A$2:$G$44474,SMALL(IF(Sheet1!$G$2:$G$44474=A$1,COLUMN($A$1:$GL$1)),ROW(1:1))-1,1),""). If I use ROW instead of COLUMN in the IF statement, I get the first result in Sheet1 for every cell. If I use COLUMN (which makes more sense), then it just returns blank for everything.



I would love a fix for this formula if possible.



If anyone could also offer guidance on how to only return each study once (eliminating the duplicates), that would be awesome.



Thank you!
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
Try
=IFERROR(INDEX(Sheet1!$A$2:$A$44474,SMALL(IF(Sheet1!$G$2:$G$44474=A$1,ROW($A$2:$A$44474)-ROW(A$2)+1),ROWS($1:1)),1),"")

Confirmed with Ctrl Shift Enter
 
Upvote 0
Ah that fixed it! Can you please explain to me why you're subtracting row a2 and adding 1? And I assume that ROWS($1:1) accomplishes the same as ROW(1:1)-1?

Thank you again!
 
Upvote 0
It was pointed out to me the other day, that without those, if you insert a new row 1 it will cause problems with the formula
 
Upvote 0

Forum statistics

Threads
1,215,073
Messages
6,122,976
Members
449,095
Latest member
Mr Hughes

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