+ Reply to Thread
Results 1 to 9 of 9

Generating Combinations of Text

  1. #1
    Registered User
    Join Date
    10-19-2010
    Location
    New York
    MS-Off Ver
    Excel 2003
    Posts
    11

    Generating Combinations of Text

    Hi,

    I am trying to find a way to generate all possible combinations from a list. The requirements of this specific task differ from other posts I've read.

    1. Each combination should maintain the order of the rows and thus eliminate duplicates caused by switching fields. ex: Column A: Dog Column B: fur = Dog,fur NOT fur,dog

    2. This is text based as each column represents a parameter for systems testing and thus each column must be included in each result. => every result should have 8 variables generated.

    3. Currently I have 8 columns each with a different number of variables (<5 in each) but i would like to be able to change this in the event we need to add further categories.

    Any guidance provided would be greatly appreciated and a huge time saver!
    Many Thanks.
    Last edited by financeguy57; 10-19-2010 at 05:09 PM.

  2. #2
    Forum Contributor
    Join Date
    02-14-2007
    Location
    Chester, England
    MS-Off Ver
    2010 & 2016
    Posts
    312

    Re: Generating Combinations of Text

    Hi

    Can you post an example sheet? I'm not 100% clear what it is you need but by the sound of things maybe a pivot table could help.

    Cheers

    Jim

  3. #3
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2502
    Posts
    26,995

    Re: Generating Combinations of Text

    Here is a quick & dirty but effective solution. In this example the categories are just numbers 1-8, and the values are just letters of the alphabet, 2-5 different values for each category.

    I hope you are going to automate this test because the number of combinations get quite large quickly. It is not hard to add more categories but with Excel 2003 you will be limited to 64K test cases. Note that with my simple example there are over 8K test cases already.

    Some Assembly Required
    Due to the size, you are going to have to go into the Enumerations and Combinations sheets and copy & fill as instructed. If I had provided a complete solution it would be too big to attach here.

    Another approach that gives a cleaner spreadsheet would be using VBA, which would have taken me a little longer to put together.
    Attached Files Attached Files
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  4. #4
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2502
    Posts
    26,995

    Re: Generating Combinations of Text

    Let me add that:

    To add values to categories, you just need to add the values in the appropriate columns, then to go Enumerations and Combinations to copy the formula to as many rows are needed. In Enumerations you will notice that when all cases are enumerated the "odometer" rolls over to 11111111.

    To add categories, you should add new category columns to the left, and then add new columns to those two worksheets and copy the leftmost column formulas into the new columns. Then also extend the rows as described above.

    (A VBA solution would have the advantage of doing no additional work to add values or categories.)

    A note on capacity
    If you have 8 categories with 4 different values each, that will consume the maximum rows available in Excel 2003.

  5. #5
    Registered User
    Join Date
    10-19-2010
    Location
    New York
    MS-Off Ver
    Excel 2003
    Posts
    11

    Re: Generating Combinations of Text

    Thank you all for your quick responses. I am about to run through your suggestions now.

    I have posted an example sheet to clarify as requested in some of the reply's. The example concentrates on Delivers and Receives. There is certainly a hierarchy to the data. Each case should always start with Del or Rec and from these 2 choices be either a full or partial. As I mentioned before a value from each column must be in each generated result.

    I am hoping to get a list I can delete cases from rather than building them out. Then, dump the ones I want into an access database to flesh out systems requirements etc.

    I hope this clarifies any vague areas from before.
    Many thanks again for all your efforts.
    -A
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    10-19-2010
    Location
    New York
    MS-Off Ver
    Excel 2003
    Posts
    11

    Re: Generating Combinations of Text

    Thanks Jimmy! Looked at the spreadsheet you gave me and it popped out all the combos that I wanted. I can certainly shave off a ton of these and come up with good sample cases.

    All the best and thank you again for your input!

  7. #7
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2502
    Posts
    26,995

    Re: Generating Combinations of Text

    Quote Originally Posted by financeguy57 View Post
    Thanks Jimmy! Looked at the spreadsheet you gave me and it popped out all the combos that I wanted. I can certainly shave off a ton of these and come up with good sample cases.

    All the best and thank you again for your input!
    With all due respect to JimmyA, it doesn't look like he posted a file. Did you mean to address that to me?

  8. #8
    Registered User
    Join Date
    10-19-2010
    Location
    New York
    MS-Off Ver
    Excel 2003
    Posts
    11

    Re: Generating Combinations of Text

    ahh my mistake! eyes are crossing. certainly not taking away from your efforts 6StringJazzer. thank you for the help.

    as i said in the post i plugged in my info and have tried to tweak it a little to cut down the number of results. tonight i'll be looking up some literature on the functions you used in there. have gotten good results so far and will definitely be able to use this in the future.

    thanks again!
    -A

  9. #9
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Generating Combinations of Text

    Another alternative attached.
    Attached Files Attached Files
    Entia non sunt multiplicanda sine necessitate

+ 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