• If you would like to post, please check out the MrExcel Message Board FAQ and register here. If you forgot your password, you can reset your password.
  • Excel articles and downloadable files provided in the articles have not been reviewed by MrExcel Publishing. Please apply the provided methods / codes and open the files at your own risk. If you have any questions regarding an article, please use the Article Discussion section.
DRSteele

All Permutations of Three Variables

Excel Version
  1. 365
In order to generate all the permutations for three variables, put the variables in an Excel Table (which is called Inventory here). You can add as many rows to the Table as desired and you can fill in all or just one of the rows for each variable. The exemplar here will spill down 60 rows, the number of permutations for this 4_3_5 = 60 setup.

These formulas rely on Excel's new dynamic calculation engine and powerful array functions (like SEQUENCE).

If you can figure out how to set this up for more than three variables, go ahead and share it with us!

Book1
HIJKLMNOPQ
5Case-Lot-ShelfCaseLotShelf
6CaseLotShelfA - w - 1Aw1
7Aw1A - w - 2Aw2
8Bx2A - w - 3Aw3
9Cy3A - w - 4Aw4
10D4A - w - 5Aw5
115A - x - 1Ax1
12A - x - 2Ax2
13435A - x - 3Ax3
1460A - x - 4Ax4
15A - x - 5Ax5
all permut
Cell Formulas
RangeFormula
O5O5=Inventory[[#Headers],[Case]]
P5P5=Inventory[[#Headers],[Lot]]
Q5Q5=Inventory[[#Headers],[Shelf]]
O6O6=INDEX(Inventory[Case],INT((SEQUENCE(J14)-1)/((COUNTA(Inventory[Lot])*(COUNTA(Inventory[Shelf])))))+1)
P6P6=INDEX(Inventory[Lot],MOD(INT((SEQUENCE(J14)-1)/COUNTA(Inventory[Shelf])),COUNTA(Inventory[Lot]))+1)
Q6Q6=INDEX(Inventory[Shelf],MOD((SEQUENCE(J14)-1),COUNTA(Inventory[Shelf]))+1)
M5M5=O5&"-"&P5&"-"&Q5
M6M6=INDEX(Inventory[Case],INT((SEQUENCE(J14)-1)/((COUNTA(Inventory[Lot])*(COUNTA(Inventory[Shelf])))))+1)&" - "&INDEX(Inventory[Lot],MOD(INT((SEQUENCE(J14)-1)/COUNTA(Inventory[Shelf])),COUNTA(Inventory[Lot]))+1)&" - "&INDEX(Inventory[Shelf],MOD((SEQUENCE(J14)-1),COUNTA(Inventory[Shelf]))+1)
H13H13=SUBTOTAL(103,[Case])
I13I13=SUBTOTAL(103,[Lot])
J13J13=SUBTOTAL(103,[Shelf])
J14J14=Inventory[[#Totals],[Case]]*Inventory[[#Totals],[Lot]]*Inventory[[#Totals],[Shelf]]
Author
DRSteele
Views
4,111
First release
Last update
Rating
0.00 star(s) 0 ratings

More Excel articles from DRSteele

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