Avatar of rrhandle8
rrhandle8
Flag for United States of America asked on

Code to produce all combinations

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
ProgrammingMicrosoft ExcelVisual Basic Classic

Avatar of undefined
Last Comment
rrhandle8

8/22/2022 - Mon
GrahamSkan

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
rrhandle8

ASKER
Not really a solution, but I was forced to close the question.
ASKER CERTIFIED SOLUTION
rrhandle8

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
[ fanpages ]

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.
Your help has saved me hundreds of hours of internet surfing.
fblack61
rrhandle8

ASKER
I figured it out before anyone posted a solution.