Vlookup return multiple values from another spreadsheet...Help!

nicole327

New Member
Joined
Jul 22, 2015
Messages
19
I have been trying to figure this one out on my own and i can't seem to get it. I have a spreadsheet with names and i need to lookup email address for them and some have more than 1. I know there is a way but i just can't figure it out. Below is an example of my 2 worksheets and the end result i am looking for.:eeek:

WORKSHEET A

[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]S123456[/TD]
[TD]Smith, John[/TD]
[/TR]
[TR]
[TD]D654321[/TD]
[TD]Doe, Jane[/TD]
[/TR]
[TR]
[TD]H234567[/TD]
[TD]Hall, Sam[/TD]
[/TR]
[TR]
[TD]G345678[/TD]
[TD]Good, Bill[/TD]
[/TR]
[TR]
[TD]A456789[/TD]
[TD]Apple, Jill[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

WORKSHEET B
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]S123456[/TD]
[TD]TEST1@GMAIL.COM[/TD]
[/TR]
[TR]
[TD]S123456[/TD]
[TD]TEST2@GMAIL.COM[/TD]
[/TR]
[TR]
[TD]D654321[/TD]
[TD]TEST3@GMAIL.COM[/TD]
[/TR]
[TR]
[TD]D654321[/TD]
[TD]TEST4@GMAIL.COM[/TD]
[/TR]
[TR]
[TD]H234567[/TD]
[TD]TEST5@GMAIL.COM[/TD]
[/TR]
[TR]
[TD]G345678[/TD]
[TD]TEST6@GMAIL.COM[/TD]
[/TR]
[TR]
[TD]G345678[/TD]
[TD]TEST7@GMAIL.COM[/TD]
[/TR]
[TR]
[TD]A456789[/TD]
[TD]TEST8@GMAIL.COM[/TD]
[/TR]
</tbody>[/TABLE]


END RESULT I WOULD LIKE

[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]S123456[/TD]
[TD]TEST1@GMAIL.COM; TEST2@GMAIL.COM[/TD]
[/TR]
[TR]
[TD]D654321[/TD]
[TD]TEST3@GMAIL.COM; TEST4@GMAIL.COM[/TD]
[/TR]
[TR]
[TD]H234567[/TD]
[TD]TEST5@GMAIL.COM[/TD]
[/TR]
[TR]
[TD]G345678[/TD]
[TD]TEST6@GMAIL.COM; TEST7@GMAIL.COM[/TD]
[/TR]
[TR]
[TD]A456789[/TD]
[TD]TEST8@GMAIL.COM[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
In C2 of Sheet1 (worksheet a) control+shift+enter, not just enter, and copy down:

=TEXTJOIN("; ",TRUE,IF(Sheet2!$A$2:$A$9=$A2,Sheet2!$B$2:$B$9,""))


where Sheet2 = worksheet b.
 
Upvote 0
This is what i get back #NAME ?
i must be doing something wrong. In C2 i hit control+shift+enter and nothing happened but i pasted anyway and got that result [TABLE="width: 173"]
<colgroup><col></colgroup><tbody>[TR]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"][/TD]
[/TR]
</tbody>[/TABLE]
 
Upvote 0
This is what i get back #NAME ?
i must be doing something wrong. In C2 i hit control+shift+enter and nothing happened but i pasted anyway and got that result [TABLE="width: 173"]
<colgroup><col></colgroup><tbody>[TR]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"][/TD]
[/TR]
</tbody>[/TABLE]

Is the TEXTJOIN function available on your Excel version?
 
Upvote 0
No, i have 2016 version.

If the native function TEXTJOIN is not available on your system...

In C2 of Sheet1 control+shift+enter, not just enter, and copy down:

=REPLACE(aconcat(IF(Sheet2!$A$2:$A$9=$A2,Sheet2!$B$2:$B$9,"")),1,2,"")

For this formula to work, add the following code for ACONCAT as a Module to your workbook using Alt+F11...

Function aconcat(a As Variant, Optional sep As String = "") As String
' Harlan Grove, Mar 2002
Dim y As Variant
If TypeOf a Is Range Then
For Each y In a.Cells
aconcat = aconcat & y.Value & sep
Next y
ElseIf IsArray(a) Then
For Each y In a
aconcat = aconcat & y & sep
Next y
Else
aconcat = aconcat & a & sep
End If
aconcat = Left(aconcat, Len(aconcat) - Len(sep))
End Function
 
Upvote 0

Forum statistics

Threads
1,223,243
Messages
6,170,971
Members
452,371
Latest member
Frana

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