returning multiple results from a vlookup onto single row

ellison

Active Member
Joined
Aug 1, 2012
Messages
356
Office Version
  1. 365
Platform
  1. Windows
Hi,


is there a way to do a vlookup between 2 different lists where the "multiple" hits are returned - rather than only the first one?


(we were using the vlookup, but it only gives us the "first" reference that it looks up)


What we'd like is for the 1st instance to be put in Col B, the second instance in Col C, the 3rd in Col D etc


Just to add to the complications(!), we are trying to do this using a partial lookup eg =vlookup("*"&A1&"*",table array,col_index_sum,FALSE)


EG

[TABLE="class: grid, width: 500, align: center"]
<tbody>[TR]
[TD]List 1[/TD]
[TD]Info from Lookup A[/TD]
[TD]Info from Lookup B[/TD]
[TD]Info from Lookup C[/TD]
[/TR]
[TR]
[TD]post[/TD]
[TD]red[/TD]
[TD]yellow[/TD]
[TD]green[/TD]
[/TR]
[TR]
[TD]gate[/TD]
[TD]white[/TD]
[TD]black[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]List 2[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]posts[/TD]
[TD]red[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]posted[/TD]
[TD]yellow[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]post[/TD]
[TD]green[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]med gate[/TD]
[TD]white[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]large gate[/TD]
[TD]black[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
 
Spreadsheet Formulas
CellFormula
A8=IFERROR(INDEX(INDEX($D$2:$J$4,MATCH($A$7,$A$2:$A$4,0),0),AGGREGATE(15,6,(COLUMN($D$1:$J$1)-COLUMN($D$1)+1)/(INDEX($D$2:$J$4,MATCH($A$7,$A$2:$A$4,0),0)<>0),ROWS($A$14:A14))),"")

<tbody>
</tbody>

<tbody>
</tbody>

So when I took this formula. It works in this scale. If I try to expand it to my full sheet (date columns 90+ and employee rows 180+) I fail miserably. Currently attempting:

=IFERROR(INDEX(INDEX($D$2:$CO$198,MATCH($A$199,$A$2:$A$198,0),0),AGGREGATE(15,6,(COLUMN($D$1:$CO$1)-COLUMN($D$1)+1)/(INDEX($D$2:$CO$198,MATCH($A$199,$A$2:$A$198,0),0)<>0),ROWS($A$207:A207))),"")

which only returns the first instance of a non-zero
 
Upvote 0

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
@ ClerkBot77

Looks like an ISTEXT would be appropriate...

ABCDEFGHIJKL
NAMETITLEHIRE DATEperson b
PERSON APACKINGALS14LS16X
PERSON BPACKINGXLL61LL11LL61
PERSON CPACKINGALS16LL11

<colgroup><col style="width: 25pxpx"><col><col><col><col><col><col><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
[TD="align: center"]1[/TD]

[TD="align: right"]1/1/2019[/TD]
[TD="align: right"]1/2/2019[/TD]
[TD="align: right"]1/3/2019[/TD]
[TD="align: right"]1/4/2019[/TD]
[TD="align: right"]1/5/2019[/TD]
[TD="align: right"]1/6/2019[/TD]
[TD="align: right"]1/7/2019[/TD]
[TD="align: right"][/TD]

[TD="align: center"]2[/TD]

[TD="align: right"]9/15/2015[/TD]

[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]

[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"][/TD]

[TD="align: center"]3[/TD]

[TD="align: right"]10/10/2018[/TD]
[TD="align: right"]0[/TD]

[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"][/TD]

[TD="align: center"]4[/TD]

[TD="align: right"]11/15/2017[/TD]

[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]

[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"][/TD]

[TD="align: center"]5[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

</tbody>
Sheet1

In L2 control+shift+enter, not just enter, and copy down:

=IFERROR(INDEX($D$2:$J$4,MATCH(L$1,$A$2:$A$4,0),SMALL(IF(ISTEXT(INDEX($D$2:$J$4,MATCH(L$1,$A$2:$A$4,0),0)),COLUMN($D$2:$J$4)-COLUMN($D$2)+1),ROWS(L$2:L2))),"")


This doesn't return any results.
 
Upvote 0
This doesn't return any results.

there was a any typo, I didn't analyse it because Excel corrected it for me :)

try
Code:
=IFERROR(INDEX($D$2:$J$4,MATCH(L$1,$A$2:$A$4,0),SMALL(IF(ISTEXT(INDEX($D$2:$J$4,MATCH(L$1,$A$2:$A$4,0),0)),COLUMN($D$2:$J$4)-COLUMN($D$2)+1),ROWS(L$2:L2))),"")
with CSE

[Table="width:, class:head"][tr=bgcolor:#000000][th] [/th][th]
L
[/th][th]
M
[/th][th]
N
[/th][/tr]
[tr=bgcolor:#FFFFFF][td=bgcolor:#000000]
1
[/td][td=bgcolor:#D6DCE4]Person A[/td][td=bgcolor:#D6DCE4]Person B[/td][td=bgcolor:#D6DCE4]Person C[/td][/tr]

[tr=bgcolor:#FFFFFF][td=bgcolor:#000000]
2
[/td][td]A[/td][td]X[/td][td]A[/td][/tr]

[tr=bgcolor:#FFFFFF][td=bgcolor:#000000]
3
[/td][td]LS14[/td][td]LL61[/td][td]LS16[/td][/tr]

[tr=bgcolor:#FFFFFF][td=bgcolor:#000000]
4
[/td][td]LS16[/td][td]LL11[/td][td][/td][/tr]

[tr=bgcolor:#FFFFFF][td=bgcolor:#000000]
5
[/td][td][/td][td][/td][td][/td][/tr]
[/table]


Add headers manually
Formula (in this case) in L2 Control+Shift+Enter drag to the right then down
 
Last edited:
Upvote 0
This doesn't return any results.

Column L of the Excel readable visual shows the results that the suggested formula delivers. Did you apply control+shift+enter as requested?

Control+shift+enter: Press down the control and the shift keys at the same time while you hit the enter key. When done successfully, Excel itself puts a pair of { and } around the formula in recognition.
 
Upvote 0
there was a any typo, I didn't analyse it because Excel corrected it for me :)

try
Code:
=IFERROR(INDEX($D$2:$J$4,MATCH(L$1,$A$2:$A$4,0),SMALL(IF(ISTEXT(INDEX($D$2:$J$4,MATCH(L$1,$A$2:$A$4,0),0)),COLUMN($D$2:$J$4)-COLUMN($D$2)+1),ROWS(L$2:L2))),"")
with CSE

[TABLE="class: head"]
<tbody>[TR="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=000000]#000000[/URL] "]
[TH][/TH]
[TH]
[COLOR=[URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFFFFF]#FFFFFF[/URL] ]L[/COLOR]​
[/TH]
[TH]
[COLOR=[URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFFFFF]#FFFFFF[/URL] ]M[/COLOR]​
[/TH]
[TH]
[COLOR=[URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFFFFF]#FFFFFF[/URL] ]N[/COLOR]​
[/TH]
[/TR]
[TR="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFFFFF]#FFFFFF[/URL] "]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=000000]#000000[/URL] "]
[COLOR=[URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFFFFF]#FFFFFF[/URL] ]1[/COLOR]​
[/TD]
[TD="bgcolor: #D6DCE4"]Person A[/TD]
[TD="bgcolor: #D6DCE4"]Person B[/TD]
[TD="bgcolor: #D6DCE4"]Person C[/TD]
[/TR]
[TR="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFFFFF]#FFFFFF[/URL] "]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=000000]#000000[/URL] "]
[COLOR=[URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFFFFF]#FFFFFF[/URL] ]2[/COLOR]​
[/TD]
[TD]A[/TD]
[TD]X[/TD]
[TD]A[/TD]
[/TR]
[TR="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFFFFF]#FFFFFF[/URL] "]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=000000]#000000[/URL] "]
[COLOR=[URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFFFFF]#FFFFFF[/URL] ]3[/COLOR]​
[/TD]
[TD]LS14[/TD]
[TD]LL61[/TD]
[TD]LS16[/TD]
[/TR]
[TR="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFFFFF]#FFFFFF[/URL] "]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=000000]#000000[/URL] "]
[COLOR=[URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFFFFF]#FFFFFF[/URL] ]4[/COLOR]​
[/TD]
[TD]LS16[/TD]
[TD]LL11[/TD]
[TD][/TD]
[/TR]
[TR="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFFFFF]#FFFFFF[/URL] "]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=000000]#000000[/URL] "]
[COLOR=[URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFFFFF]#FFFFFF[/URL] ]5[/COLOR]​
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]


Add headers manually
Formula (in this case) in L2 Control+Shift+Enter drag to the right then down




Thank you, this is working out.

Is there a good way to also capture the date in a separate column?
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,177
Members
453,021
Latest member
Justyna P

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