I am layering, stacking my options in excel. I have asked the question in a similar way, however I now want to put some more detail into it. If I have n number of boxes to stack, the possible options to stack them is 2^n-1. Let me give an example of 3 boxes and we give them the names A, B, C and D. The way they are stacked does not matter, meaning AB=BA and ABC=CAB, they count as 1 stack option. The result would be:
A, B, C, AB, BC, AC, ABC
Now I would like to create an excel file which in which I will enter the boxes letters and it gives me a list of all the possibilities for stacking. So I would provide the number of boxes and the letters. (3 boxes, A, B, C) Excel reads this in and gives me in cells the options.
Is it possible to get the options in a row underneath each other? for n number of boxes?
Is this possible? Can anyone help me with this?
Thank you in advanced!
Some Code modified from Tony Dallimore’s post on Creating a list of all possible unique combinations from an array (using VBA)
usage:
in Macro “stackBox” — change “Sheet1” to the worksheet name you
want
input the Number of boxes in cell A1
input the name in B1, C1, … and so on ..
call stackBox
Input Format & Output result in “Sheet1”:
The code: