+ Reply to Thread
Results 1 to 12 of 12

A complex Join of tables

  1. #1
    Registered User
    Join Date
    12-01-2022
    Location
    Israel
    MS-Off Ver
    Microsoft 365 Apps for business
    Posts
    5

    A complex Join of tables

    Hi everybody,
    This is my first thread, so be gentlemen
    1. I have two tables that I would like to join.
    2. As an initial step, I would like to reorganize one of the tables, and I don't know what to do:

    REG_KEY REGISTRATION_LISTING_ID ESTABLISHMENT_TYPE_ID
    5 10856 5
    5 10856 11
    5 571486 5
    5 571486 11
    5 576175 5
    5 576175 11
    5 646085 11
    6 10860 5
    6 10860 11
    6 672233 7
    6 672233 9
    6 672233 11

    As can be seen above, column A link values in column B, a portion of which are essentially unique values, that in turn link to specific values in column C.
    I essentially want to merge the unique values in columns A and B - the 5 and 10856 for instance - while the related values in column C - 5 and 11 - will be merged into one cell, and will be separated by a comma:


    5 | 10856 | 5, 11

    5 | 571486 | 5, 11
    ....
    6 | 10860 | 5, 11

    Thank you very much!
    Last edited by ViridianAnalytics; 12-01-2022 at 07:26 AM. Reason: Insert image

  2. #2
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,063

    Re: A complex Join of tables

    Next time can we have an Excel file? As you can see, the forum mucked up your formatting, big time.

    If your O365 is up to date, you can use:

    =LET(a,A2:A13,b,B2:B13,c,C2:C13,L,UNIQUE(b),K,XLOOKUP(L,b,a),T,DROP(REDUCE("",L,LAMBDA(x,y,VSTACK(x,TEXTJOIN(", ",,FILTER(c,b=y))))),1),HSTACK(K,L,T))
    Attached Files Attached Files
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  3. #3
    Registered User
    Join Date
    12-01-2022
    Location
    Israel
    MS-Off Ver
    Microsoft 365 Apps for business
    Posts
    5

    Re: A complex Join of tables

    Hi Glenn,
    WOW, Thank you so much!
    I tried to upload an illustration, but unfortunately, it didn't succeed. Next time I will upload the xls sheet itself - it is a great idea

    BR

  4. #4
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,063

    Re: A complex Join of tables

    You're welcome.



    It would be very nice if you were to just click the Add Reputation button at the foot of any of the posts of members who helped you reach a solution.

    Finally, if that takes care of your original question, please click on "Thread Tools" from the menu link (just above the first post in the thread) and mark this thread as SOLVED.

  5. #5
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,063

    Re: A complex Join of tables

    Oh, and a picture of a sheet is worse still. We can copy stuff (however badly the forum formats it) from a thread, but can do NOTHING with a non-editable picture.

  6. #6
    Registered User
    Join Date
    12-01-2022
    Location
    Israel
    MS-Off Ver
    Microsoft 365 Apps for business
    Posts
    5

    Re: A complex Join of tables

    OK, got it, Glenn.

    I do the best

  7. #7
    Registered User
    Join Date
    12-01-2022
    Location
    Israel
    MS-Off Ver
    Microsoft 365 Apps for business
    Posts
    5

    Re: A complex Join of tables

    By the way,
    The original table is much bigger (containing approximately 400-K rows!).
    I tried to expand the function of the original range, but it does not work. Does the function have any limitations?

    Thank you!

  8. #8
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,063

    Re: A complex Join of tables

    TEXTJOIN will fail at 32,767 characters.

    Option 1. VBA (someone, not me) will be able to do it.

    Option 2. Spill the results into separate cells in the same row. To follow.

    Option 3 Spilt the function into 2, which might work. Formula in yellow cells needs copied down.
    Attached Files Attached Files

  9. #9
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,063

    Re: A complex Join of tables

    Option 2....
    Attached Files Attached Files

  10. #10
    Registered User
    Join Date
    12-01-2022
    Location
    Israel
    MS-Off Ver
    Microsoft 365 Apps for business
    Posts
    5

    Re: A complex Join of tables

    Thank you so much, Glenn! It all very-very useful for me!

    I want to add a smiley over any of your replies instead of adding more and more threads.

  11. #11
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,063

    Re: A complex Join of tables

    No problem! Any time...

  12. #12
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,895

    Re: A complex Join of tables

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

    Also, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

+ 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. Join tables
    By Kel12 in forum Excel General
    Replies: 2
    Last Post: 05-26-2016, 10:27 AM
  2. Tables join
    By alexpitt in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 04-13-2016, 06:53 AM
  3. join 4 tables
    By lovinguy in forum Access Tables & Databases
    Replies: 4
    Last Post: 09-07-2013, 08:26 AM
  4. [SOLVED] SQL Join - Left Join, but with 4 tables
    By kenny.fsw in forum Access Tables & Databases
    Replies: 4
    Last Post: 05-29-2013, 09:03 AM
  5. VBA join tables
    By janulikb in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-12-2013, 02:23 PM
  6. JOIN three tables using ADO and JET
    By PingPing in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-14-2010, 11:49 AM
  7. [SOLVED] Complex SQL-ish Join
    By Dan McCollick in forum Excel General
    Replies: 0
    Last Post: 02-17-2006, 05:30 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