Link to home
Create AccountLog in
Avatar of rrhandle8
rrhandle8Flag 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.

User generated imageSalads.xlsx
Avatar of GrahamSkan
GrahamSkan
Flag of United Kingdom of Great Britain and Northern Ireland image

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
Avatar of rrhandle8

ASKER

Not really a solution, but I was forced to close the question.
ASKER CERTIFIED SOLUTION
Avatar of rrhandle8
rrhandle8
Flag of United States of America image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of [ fanpages ]
[ 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.
I figured it out before anyone posted a solution.