Return Multiple Values From Each Lookup In Range

Lewzerrrr

Active Member
Joined
Jan 18, 2017
Messages
256
Hi,

i'm I'm currently using an INDEX SMALL IF ROWS to return multiple values horizontally for each cell in A1:A100.. I then have to manually TRANSPOSE each row to make it into a verticle list.

Is there a way to do this all in one go?

I'm at a computer to give an example but it would be something like this:

A. B
Product1 Product1 Product2 Product3 Product4
Product5 Product5 Product6 Product7 Product8

Result
A
Product1
Product2
Product3
Product4
Product5
Product6


Thanks
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
You show col A and B, but it looks like you have more than just those 2?
Is each Product in it's own cell?
How many columns of data will you have?
Will all columns have data in?
 
Upvote 0
You show col A and B, but it looks like you have more than just those 2?
Is each Product in it's own cell?
How many columns of data will you have?
Will all columns have data in?

Hi,

Let me give you a better example.. this just a sample data. What I need to do is input the product name in to column B and for it to then find all the serial numbers and list them all in a single column K.

<columns($c$3:c3),"",index($i$3:$i$16,small(if($h$3:$h$16=$b3,row($i$3:$i$16)-row($i$3)+1),column(a1)))) confirmed="" with="" cse="" dragged="" down="" and="" across="" so="" this="" finds="" all="" serial="" #'s="" then="" i="" can="" do="" a="" manual="" transpose="" which="" take="" extremely="" long="" the="" array="" slow="" performance.="" is="" there="" perhaps="" vba="" method="" for="" this?
<columns($c$3:c3),"",index($i$3:$i$16,small(if($h$3:$h$16=$b3,row($i$3:$i$16)-row($i$3)+1),column(a1))))<columns($c$3:c3),"",index($i$3:$i$16,small(if($h$3:$h$16=$b3,row($i$3:$i$16)-row($i$3)+1),column(a1))))
=IF(COUNTIF($H$3:$H$16,$B3)<columns($c$3:c3),"",index($i$3:$i$16,small(if($h$3:$h$16=$b3,row($i$3:$i$16)-row($i$3)+1),column(a1))))
Confirmed with CSE. - Apologies the formula isn't pasting but it's just an INDEX SMALL IF ROW

This returns multiple serial #s for each product name I input in column B, I then perform a manual transpose array for each row which could take a while if the data needed is a lot PLUS the arrays could slow down performance..

Is there a VBA method for this?

BCDEFGHIJK
2Product NameSerial #Serial #Serial #Serial #Product NameSerial #List Of Serial #'s
3Name193807568Name19393
4Name377356Name18080
5Name425100Name17575
6Name287Name16868
7Name28777
8Name3773
9Name3356
10Name35625
11Name425100
12Name410087
13Name551
14Name558
15Name572
16Name596

<tbody>
</tbody>

</columns($c$3:c3),"",index($i$3:$i$16,small(if($h$3:$h$16=$b3,row($i$3:$i$16)-row($i$3)+1),column(a1))))
</columns($c$3:c3),"",index($i$3:$i$16,small(if($h$3:$h$16=$b3,row($i$3:$i$16)-row($i$3)+1),column(a1))))<columns($c$3:c3),"",index($i$3:$i$16,small(if($h$3:$h$16=$b3,row($i$3:$i$16)-row($i$3)+1),column(a1))))
</columns($c$3:c3),"",index($i$3:$i$16,small(if($h$3:$h$16=$b3,row($i$3:$i$16)-row($i$3)+1),column(a1))))>
 
Last edited:
Upvote 0
Can you something like this. I was able to duplicate your format with my example. My example can show a maximum of 4 serial #'s for a letter. The first formula produces all the letters. The second formula produces the all the serial #'s for a letter. The third formula produces the list of serial #'s. You need use Cntrl+Shift+Enter. Copy down (and across) when applicable. When you copy across formula 2, you will see blank spaces, but still have a formula. You need to delete these formula in the blank spaces. Otherwise, formula 3 will not work.
Formula 1 is
=IFERROR(INDEX($H$2:$H$15,MATCH(0,COUNTIF($A$1:A1,$H$2:$H$15),0))," ")

Formula 2 is
=INDEX($I$2:$I$15,SMALL(IF($H$2:$H$15=$A2,ROW($I$2:$I$15)-ROW($I$2)+1),COLUMNS($B$2:B2)))

Formula 3 is
=IFERROR(INDEX($B$2:$E$6,INT(SMALL(IF($B$2:$E$6<>"",(ROW($B$2:$E$6)-ROW($B$2)+1)*10^9+COLUMN($B$2:$E$6)-COLUMN($B$2)+1),ROWS($F$2:F2))/10^9),MOD(SMALL(IF($B$2:$E$6<>"",(ROW($B$2:$E$6)-ROW($B$2)+1)*10^9+COLUMN($B$2:$E$6)-COLUMN($B$2)+1),ROWS($F$2:F2)),10^9))," ")


Name Serial#Serial#Serial#Serial#List of SerialsNameSerial #
a12341a1
b52a2
c6783a3
d9104a4
e111213145b5
6c6
7c7
8c8
9d9
10d10
11e11
12e12
13e13
14e14

<colgroup><col span="5"><col><col span="3"></colgroup><tbody>
</tbody>


<tbody>
</tbody>

<tbody>
</tbody>

<tbody>
</tbody>
 
Upvote 0

Forum statistics

Threads
1,215,717
Messages
6,126,422
Members
449,314
Latest member
MrSabo83

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