Results 1 to 2 of 2

Thread: Vlookup-Concatenate results

  1. #1
    Junior Member
    Join Date
    Mar 2015
    Posts
    1
    Rep Power
    0

    Vlookup-Concatenate results

    HI All,

    I have searched google but am not finding exactly what I need. I am so clueless when it come to VBA any attempts I make to modify codes only result in errors.

    I have a two tab workbook going. Tab 2 has Columns A-H. This tab is listing every result for every owner in my system. Column A is the owner number(unique to each owner) Column D shows the product they received. My system generated report generates a row for each product each owner has received. So owner 1234 could have 50 rows because they received 50 products. On tab 1 I am combining the data from tab 2 onto one line per owner number. I have used SUMIF to get the total of all products per owner number. Now I need a way to pull the product names(Column D) for each owner number from tab 2, combine/concatenate into one cell (Column E) on tab 1. I tied a code that almost did it but that code was programed to work in one Tab only and its results did not eliminate duplicates or add in a Delimiter. If that code had been able to remove duplicates and put a comma between results, I could have at least cut and pasted into tab 1.

    Any help would be great!! Thank You all in Advance!

    Here is the code that almost worked:
    Code:
    Function MYVLOOKUP(lookupval, lookuprange As Range, indexcol As Long)
    Dim r As Range
    Dim result As String
    result = ""
    For Each r In lookuprange
        If r = lookupval Then
            result = result & " " & r.Offset(0, indexcol + 1)
        End If
    Next r
    MYVLOOKUP = result
    End Function
    Last edited by Admin; 03-08-2015 at 11:13 AM.

  2. #2
    Administrator Admin's Avatar
    Join Date
    Mar 2011
    Posts
    1,123
    Rep Power
    10
    Hi,

    Welcome to board !!

    Please use code tags while pasting codes.

    See if this help you: http://www.excelfox.com/forum/f12/fu...nate-values-3/
    Cheers !

    Excel Range to BBCode Table
    Use Social Networking Tools If You Like the Answers !

    Message to Cross Posters

    @ Home - Office 2010/2013/2016 on Win 10 (64 bit); @ Work - Office 2016 on Win 10 (64 bit)

Similar Threads

  1. LookUp Value and Concatenate All Found Results
    By Rick Rothstein in forum Rick Rothstein's Corner
    Replies: 48
    Last Post: 10-31-2019, 07:00 AM
  2. LookUp Value and Concatenate All Found Results
    By shaft1 in forum Excel Help
    Replies: 5
    Last Post: 12-07-2013, 09:54 PM
  3. VLOOKUP produces undesired results
    By Dimitrios Charalampidis in forum Excel Help
    Replies: 1
    Last Post: 02-15-2013, 11:32 PM
  4. MLookup not returning results
    By jomili in forum Excel Help
    Replies: 5
    Last Post: 12-20-2012, 09:16 PM
  5. VLOOKUP with Multiple Results
    By Admin in forum Excel and VBA Tips and Tricks
    Replies: 2
    Last Post: 05-26-2011, 10:29 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •