VLOOKUP and return multiple values conatenate

sk2018

New Member
Joined
Jul 7, 2018
Messages
26
Office Version
  1. 2016
Platform
  1. Windows
I am using Microsoft Excel 2016.

I need to use vlookup and return the multiple values with concatenation.
Based on Value in Column A, I need to return the reference value in Access worksheet.
I need the B2 to show Project Manager, Sponsor
B3 to show Business Analyst, IT Lead, Functional Lead
B4 to show Project Manager

How can we do that in Excel? I have tried googling around.. but it is to use TEXTJOIN which is not available in excel 2016.
Appreciate your help in this.
1602583209002.png


1602583234021.png
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
I am using Microsoft Excel 2016.
I suggest that you update your Account details (click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using. (Don’t forget to scroll down & ‘Save’)

I also suggest that you investigate XL2BB for providing sample data to make it easier for helpers by not having to manually type out sample data to test with.

Worksheet functions in Excel 2016 (& earlier) do not lend themselves well to this sort of text joining. I would employ a user-defined function in vba. To implement ..
1. Right click any sheet name tab in your workbook and choose "View Code".
2. In the Visual Basic window use the menu to Insert|Module
3. Copy and Paste the code below (you can use the icon at the top right of the code pane below) into the main right hand pane that opens at step 2.
4. Close the Visual Basic window.
5. Enter the formula as shown in the screen shot below and copy down.
6. Your workbook will need to be saved as a macro-enabled workbook (*.xlsm)

VBA Code:
Function ListAccess(rData As Range, sID As String) As String
  sID = "|" & sID & "|"
  ListAccess = Replace(Join(Filter(Application.Transpose(Evaluate("""|""&" & rData.Columns(1).Address(External:=True) & "&""|""&" & rData.Columns(2).Address(External:=True))), sID), ", "), sID, "")
End Function

sk2018.xlsm
AB
1IDAccess
21PM
32BA
41S
53PM
62ITL
72FL
Access


sk2018.xlsm
AB
1IDAccess
21PM, S
32BA, ITL, FL
43PM
Sheet1
Cell Formulas
RangeFormula
B2:B4B2=ListAccess(Access!A$2:B$7,A2)
 
Upvote 0
I suggest that you update your Account details (click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using. (Don’t forget to scroll down & ‘Save’)

I also suggest that you investigate XL2BB for providing sample data to make it easier for helpers by not having to manually type out sample data to test with.

Worksheet functions in Excel 2016 (& earlier) do not lend themselves well to this sort of text joining. I would employ a user-defined function in vba. To implement ..
1. Right click any sheet name tab in your workbook and choose "View Code".
2. In the Visual Basic window use the menu to Insert|Module
3. Copy and Paste the code below (you can use the icon at the top right of the code pane below) into the main right hand pane that opens at step 2.
4. Close the Visual Basic window.
5. Enter the formula as shown in the screen shot below and copy down.
6. Your workbook will need to be saved as a macro-enabled workbook (*.xlsm)

VBA Code:
Function ListAccess(rData As Range, sID As String) As String
  sID = "|" & sID & "|"
  ListAccess = Replace(Join(Filter(Application.Transpose(Evaluate("""|""&" & rData.Columns(1).Address(External:=True) & "&""|""&" & rData.Columns(2).Address(External:=True))), sID), ", "), sID, "")
End Function

sk2018.xlsm
AB
1IDAccess
21PM
32BA
41S
53PM
62ITL
72FL
Access


sk2018.xlsm
AB
1IDAccess
21PM, S
32BA, ITL, FL
43PM
Sheet1
Cell Formulas
RangeFormula
B2:B4B2=ListAccess(Access!A$2:B$7,A2)


@Peter_SSs,

Thanks a lot.
I have updated my profile and noted on XL2BB.

The vb code is working perfectly great.


Thanks =)
 
Upvote 0

Forum statistics

Threads
1,214,924
Messages
6,122,294
Members
449,077
Latest member
Rkmenon

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