+ Reply to Thread
Results 1 to 7 of 7

Generating full list of scenarios (or combinations) of data in columns

  1. #1
    Registered User
    Join Date
    07-28-2015
    Location
    London, England
    MS-Off Ver
    2013
    Posts
    3

    Generating full list of scenarios (or combinations) of data in columns

    Hello,

    I have a number of scenarios to test for and I am trying to pull a total number together (plus actually have a list of all the possible combinations) of data or options that are available in columns in a table.

    As an example:

    Column A contains a list:
    Item A
    Item B
    Item C

    Column B contains a different list:
    Item D
    Item E

    Column C contains a different list:
    Item F

    All of the items can crop up in a scenario, and there are multiple combinations. For example:

    Scenario 1: Item A, Item D, Item F
    Scenario 2: Item A, Item E, Item F
    Scenario 3: Item B, Item D, Item F
    Scenario 4: Item B, Item, E, Item F
    Scenario 5: Item C, Item D, Item F
    Scenario 6: Item C, Item E, Item F

    I have manually had to work out all of the combinations - I'd like Excel to do that for me. In reality I have about 10 columns and some lists contain about 10 different data items.

    Any ideas on how I can achieve this would be amazing - given that I believe there are about 5000 possible unique combinations/scenarios!


    Thanks,

    Chris

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,727

    Re: Generating full list of scenarios (or combinations) of data in columns

    I could give you a way of doing this for the 3 columns in your example, but it might not be obvious to you how to extend this to your real situation of 10 columns. Post an example file showing the 10 columns with their data items.

    To attach a file, click on Go Advanced while you are posting a reply, then scroll down and click on Manage Attachments, then follow the on-screen prompts (basically, navigate to the file and select it, Upload it, Close the window, then Submit post).

    Pete

  3. #3
    Registered User
    Join Date
    07-28-2015
    Location
    London, England
    MS-Off Ver
    2013
    Posts
    3

    Re: Generating full list of scenarios (or combinations) of data in columns

    Hi Pete - thanks for your response. I have had to change some of the data as it is sensitive, but this is the format I'm working in with the right number of options per column.
    Attached Files Attached Files

  4. #4
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,727

    Re: Generating full list of scenarios (or combinations) of data in columns

    As you have a variable number of entries in each column, it would help to put this formula in B2:

    =COUNTA(B3:B8)

    then copy across to M2.

    With these types of problems, I like to start with the right-most column, so put this formula in M14:

    =INDEX(M$3:M$4,MOD(ROWS($1:1)-1,M$2)+1)

    and copy it down a few rows - you can see that the two entries alternate. Then you can put this formula in L14:

    =INDEX(L$3:L$5,MOD(INT((ROWS($1:1)-1)/PRODUCT(M$2:$M$2)),L$2)+1)

    and copy that down a few rows - hopefully you can see the pattern emerging. Strictly speaking, you don't need the PRODUCT(M$2:$M$2) term here, as it could be replaced by just M$2, but that formula can now be used in all the other columns. Copy it into K14 and you will get this:

    =INDEX(K$3:K$5,MOD(INT((ROWS($1:1)-1)/PRODUCT(L$2:$M$2)),K$2)+1)

    and when you copy that down a few rows you will see the pattern more strongly. Just copy the formula from K14 into B14:J14, and then copy the formulae down the rows. Put this formula in A2 (widen the column to see the result):

    =PRODUCT(B2:M2)

    to tell you how many rows you will need. Add 14 onto it (as you started in row 14) to tell you where the pattern will start to repeat.

    Hope this helps.

    Pete

  5. #5
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,914

    Re: Generating full list of scenarios (or combinations) of data in columns

    see the attached file
    one helper row was created
    due to excess file limited all formats were removed
    copy the cell B16 and paste across
    Attached Files Attached Files
    Samba

    Say thanks to those who have helped you by clicking Add Reputation star.

  6. #6
    Registered User
    Join Date
    07-28-2015
    Location
    London, England
    MS-Off Ver
    2013
    Posts
    3

    Re: Generating full list of scenarios (or combinations) of data in columns

    This is exactly what I needed - you have helped so much!

    Thanks Pete!


    Chris

  7. #7
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,727

    Re: Generating full list of scenarios (or combinations) of data in columns

    Glad to hear that, Chris - thanks for feeding back.

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

    Also, since you are relatively new to the forum, you might like to know that you can directly thank those who have helped you by clicking on the small "star" icon located in the lower left corner of a post that you have found to be helpful (not just in this thread - for any post that has helped you). This also adds to the reputation of the poster (the small green bars in the poster's profile).

    Pete

+ 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. Generating All Possible Scenarios/Outcomes
    By chicity26 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 04-08-2015, 11:30 AM
  2. generating all possible combinations
    By tuckertuesday in forum Excel General
    Replies: 3
    Last Post: 12-10-2014, 06:24 PM
  3. [SOLVED] Generating all possible combinations per macro
    By KaNi2015 in forum Excel Programming / VBA / Macros
    Replies: 27
    Last Post: 10-06-2014, 10:36 AM
  4. [SOLVED] Generating a List of Possible Permutation Combinations
    By glennchung in forum Excel General
    Replies: 3
    Last Post: 05-12-2014, 06:39 PM
  5. generating combinations
    By fern4500 in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 04-11-2012, 08:47 AM
  6. Generating Permutations and Combinations
    By e4excel in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 02-25-2011, 03:17 PM
  7. Help generating combinations
    By JamRock in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-02-2006, 03:40 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