+ Reply to Thread
Results 1 to 15 of 15

Lookup numbers and concatenate them in a different cell

  1. #1
    Registered User
    Join Date
    11-21-2013
    Location
    United States
    MS-Off Ver
    Excel 2013
    Posts
    99

    Lookup numbers and concatenate them in a different cell

    Hi,

    Can someone please help me with two formulas for one data set. The data is attached in the spreadsheet: "Product IDs".
    The data is a set of Master Product IDs (parent) and the Linked to them Products (children). I need to create a relationship between unique parents (Master Product IDs) and their children (Linked Products)

    From the Data Set table, need to vlookup the unique value in column A (Master Product ID) and return comma delimited (concatenated) corresponding values from column B (Linked Products). So, the result will be as shown in Table

    I would really appreciate your help. Thank you in advance!

    Table 1 Product IDs.xlsx
    DATA SET
    Master Product ID Linked Products
    11 1
    11 2
    11 3
    11 4
    4 11
    4 3
    4 2
    4 1
    3 1
    3 2
    3 4
    3 11
    2 1
    2 3
    2 4
    2 11
    1 2
    1 11
    1 4
    1 3
    232 43
    232 85
    232 16
    16 232
    16 85
    16 43
    43 85
    43 16
    43 232
    85 16
    85 232
    85 85
    123 89
    89 123


    I need to


    WOULD RETURN comma delimited Linked Product IDs for each corresponding product like depicted in Linked Products column in Table 2 below.

    Table 2
    Master Product ID Linked Products
    11 1,2,3,4
    4 1,2,3,11
    3 1,2,4,11
    2 1,3,4,11
    1 2,3,4,11,
    232 16,43,85
    16 43,85,232
    43 16,85,232
    85 16,43,232
    123 89
    89 123

  2. #2
    Valued Forum Contributor
    Join Date
    07-07-2014
    Location
    Washington DC
    MS-Off Ver
    2007
    Posts
    1,047

    Re: Lookup numbers and concatenate them in a different cell

    It's not simple and the concatenations will require some customization, but this gets the job done. You just need to write one concatenation equation for each number of children and copy down.
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    11-21-2013
    Location
    United States
    MS-Off Ver
    Excel 2013
    Posts
    99

    Re: Lookup numbers and concatenate them in a different cell

    Hi hoyasaxa215,

    You created two step solution:step #1 - put the data in columns by using the formula below; step #2 - concatenate the rows in step #1.

    I appreciate very much you help, but I have 25 thousand rows in the data spreadsheet and it would be problematic to complete step #1 - prepare the data before concatenating it. In other words I'll not be able to put all numbers in the rows because there are 25 thousand of them and can be up to 100,000.

    Is it possible to get one step formula?

    Thank you!!!

  4. #4
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Lookup numbers and concatenate them in a different cell

    @Neyme

    You need VBA solution for this. Unfortunately, Excel doesn't a native concatenate function that would work over the range of cells.
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  5. #5
    Registered User
    Join Date
    11-21-2013
    Location
    United States
    MS-Off Ver
    Excel 2013
    Posts
    99

    Re: Lookup numbers and concatenate them in a different cell

    Hi AlKey,
    Thank you for the direction! Would you be able to help me with the VBA code which I could enter as user customized formula in the VBA module and provide me with the formula that I can then enter in Excel?

    I would be very grateful if you can help!!!

  6. #6
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Lookup numbers and concatenate them in a different cell

    I suggest you change sub forum to Excel Programming / VBA / Macros so someone with VBA experience could see your post.

  7. #7
    Registered User
    Join Date
    11-21-2013
    Location
    United States
    MS-Off Ver
    Excel 2013
    Posts
    99

    Re: Lookup numbers and concatenate them in a different cell

    Got it. Thank you for the advise!

  8. #8
    Forum Contributor WinteE's Avatar
    Join Date
    04-07-2007
    Location
    Netherlands
    Posts
    544

    Re: Lookup numbers and concatenate them in a different cell

    Hi Neyme,

    Is it possible to sort the dataset of 25000 rows ?
    Just keep it simple !


    http://www.excelguide.eu
    In English as well as in Dutch

  9. #9
    Registered User
    Join Date
    11-21-2013
    Location
    United States
    MS-Off Ver
    Excel 2013
    Posts
    99

    Re: Lookup numbers and concatenate them in a different cell

    Hi WinteE,

    Unfortunately, it is not possible to sort it because the relationships between the parent master ID and it's linked products will be lost. Do you have something in mind?

    Thanks so much!

  10. #10
    Registered User
    Join Date
    11-21-2013
    Location
    United States
    MS-Off Ver
    Excel 2013
    Posts
    99

    Re: Lookup numbers and concatenate them in a different cell

    Hi hoyasaxa215,

    Thank you so much for your help! I added a reputation for you. Ccn you please explain what your formula (below) does, how it works?

    IFERROR(INDEX($B$4:$B$37, SMALL(IF($E16=$A$4:$A$37, ROW($A$4:$A$37)-ROW($A$4)+1), COLUMN(A1))),"")
    Last edited by Neyme; 07-24-2014 at 11:57 AM.

  11. #11
    Forum Contributor WinteE's Avatar
    Join Date
    04-07-2007
    Location
    Netherlands
    Posts
    544

    Re: Lookup numbers and concatenate them in a different cell

    Hi,

    I worked it out a couple of hours ago and thought I'd posted it. But not.

    See attached file for a solution without manual input.

    Success
    Attached Files Attached Files

  12. #12
    Registered User
    Join Date
    11-21-2013
    Location
    United States
    MS-Off Ver
    Excel 2013
    Posts
    99

    Re: Lookup numbers and concatenate them in a different cell

    Hi WinteE,

    It is a very elegant solution! Good job! Unfortunately, I get #NAME? error when paste your formula: ARLOOKUP($B$1:$C$25000,B2,C$1)? How can I fix it?

    Thank you! Thank you!

  13. #13
    Registered User
    Join Date
    11-21-2013
    Location
    United States
    MS-Off Ver
    Excel 2013
    Posts
    99

    Re: Lookup numbers and concatenate them in a different cell

    Hi WinteE,

    It is a very elegant solution! Good job! Unfortunately, I get #NAME? error when paste your formula: ARLOOKUP($B$1:$C$25000,B2,C$1)? How can I fix it? What kind of formula ARLOOKUP is?

    Thank you! Thank you!

  14. #14
    Forum Contributor WinteE's Avatar
    Join Date
    04-07-2007
    Location
    Netherlands
    Posts
    544

    Re: Lookup numbers and concatenate them in a different cell

    Hi Neyme,

    I suppose you try to run this function in another Excel-file ?

    The =ARLOOKUP() function is a User Defined Function. Therefore you need to copy the code for this function if you want to use this function in another Excel-file.
    Hope you're somewhat familiar with VBA ...

    The code has to be placed in a module of the VBA-object.

    With Alt + F11 you can open VBA
    Right-click 'Microsoft Excel -objects' and add a module
    Copy the entire Public Function ARLOOKUP code to this module

    Now you can use the function in this file.

    Hope this helps. Let me know if you encounter any other problems on this.

    Success
    WinteE
    Last edited by WinteE; 07-24-2014 at 12:40 PM.

  15. #15
    Valued Forum Contributor
    Join Date
    07-07-2014
    Location
    Washington DC
    MS-Off Ver
    2007
    Posts
    1,047

    Re: Lookup numbers and concatenate them in a different cell

    Neyme, I just programmed "=ARLOOKUP" and it's awesome. Will do exactly what you're looking for (well, may need to trim out the spaces). Definitely worth setting up.

  16. #16
    Registered User
    Join Date
    11-21-2013
    Location
    United States
    MS-Off Ver
    Excel 2013
    Posts
    99

    Re: Lookup numbers and concatenate them in a different cell

    I can do copy & paste the code into the module, but not really familiar with the VBA. Thank you for all your help. You saved me and my team a lot of time.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Lookup and Concatenate
    By nico67 in forum Excel Formulas & Functions
    Replies: 14
    Last Post: 10-22-2012, 05:15 PM
  2. [SOLVED] Require Function to Lookup and Concatenate Mulltiple Results To Single Cell
    By nuttyengineer in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-18-2012, 12:19 AM
  3. Excel 2007 : Lookup and Concatenate help
    By jonesdogg in forum Excel General
    Replies: 1
    Last Post: 06-10-2011, 01:52 AM
  4. How lookup numbers between range numbers in 1 cell ?
    By termal in forum Excel General
    Replies: 4
    Last Post: 02-06-2010, 06:57 AM
  5. Lookup numbers in sheet and assign it's cell reference
    By dgraham in forum Excel General
    Replies: 11
    Last Post: 12-18-2007, 09:48 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1