Code to produce all combinations

rrhandle8 used Ask the Experts™
I need some VBA code to create all possible combinations for building a salad.  See image below.  Below the ingredients, are a sample of what I mean by combinations.

The user may add additional columns of Extras.

This is just a sample.  In the real workbook, each Extra will have two additional fields: Serving Size and Calories.  I am sure I can figure out how to add those.

The workbook is also attached.

Ingredients and the first 6 combinationsSalads.xlsx
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2012

The code for this sort of thing is fairly simple. However - ..
the number of combinations can easily become so overwhelming as to be impractible.
In your limited sample of very low figues, the number is
1*2*3*3*2. i.e. 36

With a few more choices and more sets to choose from, it can become huge.
3*4*3*7*2*5. becomes 2520

I suggest that you record the number of combinations actually chosen rather than multiple unchosen possibilities


Not really a solution, but I was forced to close the question.
The way I did it was to read the first column into an array, then concatenate the 2nd column to the array, then move on to the next column.
Not really a solution, but I was forced to close the question.

Forced by whom, or by what?

From your most recent response, it sounds like you resolved your own issue.

I have requested attention so that a Moderator can review the thread & advise accordingly.


I figured it out before anyone posted a solution.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial