Generate all possible combinations from the elements of the matrix

Bokov777

New Member
Joined
Dec 25, 2016
Messages
1
I have a matrix (14 rows and 5 columns):
1 | 2 | 3 | 4 | 5;
--|---|----|---|--;
66| 67| 68 |69 |70.

All elements are positive integers.
I need to generate all possible combinations from the elements of this matrix. Each combination must contain 14 elements – one from each row.
Sample combinations (with 14 elements each):
1, 6, ... 61, 66;
1, 7, ... 64, 70.

Excel VBA code to return all these combinations will be appreciated.
How many combinations can be formed?
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
I don't know VBA but I'm pretty sure to calculate permutations is just :
14!/(14−9)! = 726485760

Edit: sorry wrong number
14!/(14−5)! = 240240
 
Last edited:
Upvote 0

Forum statistics

Threads
1,216,077
Messages
6,128,685
Members
449,463
Latest member
Jojomen56

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