Tip: Other languages are Google-Translated. You can visit the English version of this link.
Log in
x
or
x
x
Register
x

or

How to vlookup to return multiple values in one cell in Excel?

Normally, in Excel, when you use the VLOOKUP function, if there are multiple values to match the criteria, you just can get the first one. But, sometimes, you want to return all the corresponding values which meet the criteria into one cell as following screenshot shown, how could you solve it?

Vlookup to return multiple values in one cell with User Defined Function

Vlookup to return multiple values in one cell with kutools for Excel

doc-vlookup-multiple-values-one-cell-1


Vlookup to return multiple corresponding values in one single cell:

With Kutools for Excel’s Advanced Combine Rows utiltiy, you can quickly combine multiple duplicate rows into one record based on key columns, and it also can apply some calculations such as sum, average, count and so on for other columns.

  • 1. Specify the key column that you want to combine other column based on;
  • 2. Choose the separator for your combined data.

doc combine text based on criteria 10

Kutools for Excel: with more than 200 handy Excel add-ins, free to try with no limitation in 60 days. Download and free trial Now!

>

The traditional VLOOKUP function may not help you to solve this problem, but, I will create a User Defined Function for you to deal with this task. Please do as follows:

1. Activate your worksheet which you want to vlookup multiple values into one cell.

2. Hold down the ALT + F11 keys, and it opens the Microsoft Visual Basic for Applications window.

3. Click Insert > Module, and paste the following code in the Module Window.

VBA code: Vlookup to return multiple values in one cell

Function MYVLOOKUP(pValue As String, pWorkRng As Range, pIndex As Long)
'Update 20150310
Dim rng As Range
Dim xResult As String
xResult = ""
For Each rng In pWorkRng
    If rng = pValue Then
        xResult = xResult & " " & rng.Offset(0, pIndex - 1)
    End If
Next
MYVLOOKUP = xResult
End Function

4. Then save and close this code, go back to the worksheet, and enter this formula: =myvlookup(E6,$A$2:$C$15,2) into a specific blank cell where you want to place the result, then press Enter key to get all the corresponding values in one cell that you want, see screenshot:

doc-vlookup-multiple-values-one-cell-2

Note:

In the above formula: E6 is the value which you want to return its relative information, A2:C15 is the data range you use, the number 2 indicates the column number that your matched value is returned.


 If you have our Kutools for Excel, with its Advanced Combine Rows feature, you can quickly merge or combine the rows based on the same value and do some calculations.

Kutools for Excel : with more than 300 handy Excel add-ins, free to try with no limitation in 60 days

After installing Kutools for Excel, please do as follows:

1.  Select the data range that you want to combine one column data based on another data.

2.  Click Kutools > Content > Advanced Combine Rows, see screenshot:

doc-vlookup-multiple-values-one-cell-5

3.  In the Combine Rows Based on Column dialog box, click the key column to be combined based on, and then click Primary Key. Then click another column that you want to combine its data based on the key column, and click Combine to choose one separator for separating the combined data, see screenshot:

doc-vlookup-multiple-values-one-cell-6

4.  Then click OK button, and you will get the following results:

doc-vlookup-multiple-values-one-cell-3 -2 doc-vlookup-multiple-values-one-cell-4-4

Click to know more about this Advanced Combine Rows feature.

Download and free trial Kutools for Excel Now !


Kutools for Excel: with more than 200 handy Excel add-ins, free to try with no limitation in 60 days. Download and free trial Now!


Related articles:

How to vlookup next largest value in Excel?

How to vlookup in two dimensional table in Excel?

How to vlookup to another workbook?


Recommended Productivity Tools

Ribbon of Excel (with Kutools for Excel installed)

300+ Advanced Features Increase Your Productivity by 71%, and Help You To Stand Out From Crowd!

Would you like to complete your daily work quickly and perfectly? Kutools For Excel brings 300+ cool and powerful advanced features (Combine workbooks, sum by color, split cell contents, convert date, and so on...) for 1500+ work scenarios, helps you solve 82% Excel problems.

  •  Deal with all complicated tasks in seconds, help to enhance your work ability, get success from the fierce competition, and never worry about being fired.
  •  Save a lot of work time, leave much time for you to love and care the family and enjoy a comfortable life now.
  •  Reduce thousands of keyboard and mouse clicks every day, relieve your tired eyes and hands, and give you a healthy body.
  •  Become an Excel expert in 3 minutes, and get admiring glance from your colleagues or friends.
  •  No longer need to remember any painful formulas and VBA codes, have a relaxing and pleasant mind, give you a thrill you've never had before.
  •  Spend only $39, but worth than $4000 training of others. Being used by 110,000 elites and 300+ well-known companies.
  •  60-day unlimited free trial. 60-day money back guarantee. Free upgrade and support for 2 years. Buy once, use forever.
  •  Change the way you work now, and give you a better life immediately!

Office Tab Brings Efficient And Handy Tabs to Office (include Excel), Just Like Chrome, Firefox, And New IE

  • Increases your productivity by 50% when viewing and editing multiple documents.
  • Reduce hundreds of mouse clicks for you every day, say goodbye to mouse hand.
  • Open and create documents in new tabs of same window, rather than in new windows.
  • Help you work faster and easily stand out from the crowd! One second to switch between dozens of open documents!
Say something here...
symbols left.
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.
  • To post as a guest, your comment is unpublished.
    Devinder Kaur · 1 months ago
    do we have the code to work it from last to first. like we have multiple values in columnB and we want them in row with column A remain same.
  • To post as a guest, your comment is unpublished.
    Pam · 6 months ago
    For some reason this macro is extremely slow for me, every time I click anywhere it takes about 5-10 minutes to calculate.
  • To post as a guest, your comment is unpublished.
    Alex · 7 months ago
    Tthat's what I wanted! Thank you very much XD
  • To post as a guest, your comment is unpublished.
    Tom T · 9 months ago
    This is amazing, thank you!
  • To post as a guest, your comment is unpublished.
    Mark · 10 months ago
    Great function, however chunking through 100,000 records proves a bit much for my poor laptop, will need to let it run overnight!