Help With Combination Generation

rmence

New Member
Joined
Oct 20, 2015
Messages
23
I need help with generating all combinations of 9 columns/groups of text.

I have a sheet called "dinneroptions" and a sheet called "combinations".
On the dinneroptions sheet I have (with headers):

(Col A)
Drink
Water
Tea
Dr. Pepper
Coke
Diet Coke

(Col B)
Appetizer
Bread
Cheese Fries
Garlic Bread
Chips

(Col C)
Main Course
Chicken Salad
Burger
Cheese Burger

And so on for 9 columns. Sometimes a column will have 1 option, sometimes dozens.
What I would like to do is put all my options in those 9 columns,
and then generate all possible combinations on the "combinations" sheet, with or without headers.
I would prefer just values be outputted just in case some of the options are being pulled in with a formula, if that makes any sense.
I am not real experienced with vba or macros but figure this is what I will need.
If anyone can provide help I can figure it out from there.
Thanks so much for any help!
-Rick
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
WaterBreadChicken Salad3columns5
TeaCheese FriesBurger5largest number of rows4
Dr. PepperGarlic BreadCheese Burger3
CokeChips
Diet Coke
the 5, 4, 3 to the right are automatic counters of items in each column
this macro gives you all combinations
rr = 19
For j = 1 To Cells(1, 15)
For k = 1 To Cells(2, 15)
For l = 1 To Cells(3, 15)
rr = rr + 1
Cells(rr, 1) = Cells(j, 1) & " with " & Cells(k, 2) & " with " & Cells(l, 3)
Next l
Next k
Next j
Water with Bread with Chicken SaladEnd Sub
Water with Bread with Burger
Water with Bread with Cheese Burger
Water with Cheese Fries with Chicken Salad
Water with Cheese Fries with Burger
Water with Cheese Fries with Cheese Burger
Water with Garlic Bread with Chicken Salad
Water with Garlic Bread with Burger
Water with Garlic Bread with Cheese Burger
Water with Chips with Chicken Salad
Water with Chips with Burger
Water with Chips with Cheese Burger
Tea with Bread with Chicken Salad
Tea with Bread with Burger
Tea with Bread with Cheese Burger
Tea with Cheese Fries with Chicken Salad
Tea with Cheese Fries with Burger
Tea with Cheese Fries with Cheese Burger
Tea with Garlic Bread with Chicken Salad
Tea with Garlic Bread with Burger
Tea with Garlic Bread with Cheese Burger
Tea with Chips with Chicken Salad
Tea with Chips with Burger
Tea with Chips with Cheese Burger
Dr. Pepper with Bread with Chicken Salad
Dr. Pepper with Bread with Burger
Dr. Pepper with Bread with Cheese Burger
Dr. Pepper with Cheese Fries with Chicken Salad
Dr. Pepper with Cheese Fries with Burger
Dr. Pepper with Cheese Fries with Cheese Burger
Dr. Pepper with Garlic Bread with Chicken Salad
Dr. Pepper with Garlic Bread with Burger
Dr. Pepper with Garlic Bread with Cheese Burger
Dr. Pepper with Chips with Chicken Salad
Dr. Pepper with Chips with Burger
Dr. Pepper with Chips with Cheese Burger
Coke with Bread with Chicken Salad
Coke with Bread with Burger
Coke with Bread with Cheese Burger
Coke with Cheese Fries with Chicken Salad
Coke with Cheese Fries with Burger
Coke with Cheese Fries with Cheese Burger
Coke with Garlic Bread with Chicken Salad
Coke with Garlic Bread with Burger
Coke with Garlic Bread with Cheese Burger
Coke with Chips with Chicken Salad
Coke with Chips with Burger
Coke with Chips with Cheese Burger
Diet Coke with Bread with Chicken Salad
Diet Coke with Bread with Burger
Diet Coke with Bread with Cheese Burger
Diet Coke with Cheese Fries with Chicken Salad
Diet Coke with Cheese Fries with Burger
Diet Coke with Cheese Fries with Cheese Burger
Diet Coke with Garlic Bread with Chicken Salad
Diet Coke with Garlic Bread with Burger
Diet Coke with Garlic Bread with Cheese Burger
Diet Coke with Chips with Chicken Salad
Diet Coke with Chips with Burger
Diet Coke with Chips with Cheese Burger

<colgroup><col><col><col><col span="13"></colgroup><tbody>
</tbody>
 
Upvote 0

Forum statistics

Threads
1,214,983
Messages
6,122,588
Members
449,089
Latest member
Motoracer88

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top