+ Reply to Thread
Results 1 to 6 of 6

Create 2 columns and populate variable data combinations

  1. #1
    Registered User
    Join Date
    03-17-2011
    Location
    Illinois
    MS-Off Ver
    2007-2010
    Posts
    22

    Create 2 columns and populate variable data combinations

    I hope you don't mind a mini novel:

    Need to create a table based on 2 other tables.
    The resulting table would consist of every combination (and vise versa) that the 2 source tables would create. For example:
    Source data 1 located in column A (A2):
    Blue
    Red
    Green
    Orange

    Source data 2 located in column L (L2)
    Circle
    Box
    Triangle
    Square
    Rectangle

    Both source data columns can have a variable number of entries.
    Need to create the following data table on a different worksheet utilizing columns A and B
    (Blue in col A, Circle in Column B in the example that follows):

    Blue Circle
    Blue Box
    Blue Triangle
    Blue Square
    Blue Rectangle
    Red Circle
    Red Box
    Red Triangle
    Red Square
    Red Rectangle
    Green Circle
    Green Box
    Green Triangle
    Green Square
    Green Rectangle
    Orange Circle
    Orange Box
    Orange Triangle
    Orange Square
    Orange Rectangle
    Circle Red
    Circle Blue
    Circle Green
    Circle Orange
    Box Red
    Box Blue
    Box Green
    Box Orange
    Triangle Red
    Triangle Blue
    Triangle Green
    Triangle Orange
    Square Red
    Square Blue
    Square Green
    Square Orange
    Rectangle Red
    Rectangle Blue
    Rectangle Green
    Rectangle Orange

    In short: each combination of all the values from both columns would be represented in the new table.
    The reason for this is to allow updating of a list to include new items and combinations of available products.
    I've extracted the unique values from the new table. This works in a validation list dropdown on another sheet, where the user can enter a color, and an adjacent column will populate all the shapes associated with that color. The necessity of a macro is for the purposes of updating with additions and deletions from both data source tables. This macro can rebuild the table from scratch with each refresh. I can add a sorting provision, and code to adjust the named range fields.
    I'm hoping that my approach to this is fundamentally sound, and workable. Just need a vehicle to make updating this workable. Other approaches would be certainly appreciated as well.
    Thank you for your ideas.
    Pete
    Last edited by Pete123abc; 03-18-2011 at 01:00 PM.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Create 2 columns and populate variable data combinations

    This should do it:
    Please Login or Register  to view this content.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    03-17-2011
    Location
    Illinois
    MS-Off Ver
    2007-2010
    Posts
    22

    Re: Create 2 columns and populate variable data combinations

    Jerry, thank you for the work on the code. It performs half of the matches. In other words, it takes column A, and applies an instance of column L for each value. Great! What also needs to happen, is that it should also take values from column L, and applies an instance of column A for each value. As it is in the OP, it starts with colors leading the combinations; entering values from L. Also needs to use column L first, in the example above referenceing shapes, and extends them down with a matching color.
    Many thanks.
    Pete
    Last edited by Pete123abc; 03-18-2011 at 04:19 PM.

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Create 2 columns and populate variable data combinations

    There's no need to "quote" my post into yours, it merely clutters your own thread. (unless you're pointing out/discussing a specific line or comment, that is.) Just use the Quick Reply option instead.

    I had hoped you would take it on yourself to add the other section since it is merely a reversal of what we already did.

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    03-17-2011
    Location
    Illinois
    MS-Off Ver
    2007-2010
    Posts
    22

    Re: Create 2 columns and populate variable data combinations

    Many thanks. I did make the effort to extend your code and to complete the process. It was not behaving, with 400 errors, etc. I'm grateful for your interest and patience. Thanks so much.
    Pete

  6. #6
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Create 2 columns and populate variable data combinations

    If that takes care of your need, please click EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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