Making Excel List combinations

Karlsen

New Member
Joined
Jun 11, 2011
Messages
1
I am trying to program excel to list all possible combinations for 14 Items, The combinations only use ten of those items and must allow repeating. I know that this is a massive amount of data. nCr= ((n+r)-1)!/(r!)(n-1)!,
14C10=((14+10)-1))!/(10!)(14-1)!= 1,144,066 possible combinations. I want excel to display these combinations for me. For example I have 14 types of food
Apples (A), Bananas (B), Carrots (C), Dates (D), Eggplants (E), Figs (F), Grapes (G), Ham (H), Ice (I), Jam (J), Kiwis (K), Limes (L), Mangoes (M), and Nectarines (N) of which only ten are needed in each combination.

So in Column A, I want the choices A1=(A), A2= (B), A3= (C) and so on. In Column C I want each cell to hold the possible combination For example, Cell C1 could look like (A,A,B,C,C,D,E,F,G,H).

Any help you could give me in how to write this in VBA would be greatly appreciated.
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Karlsen,


If worksheet Sheet1 looks like this:


Excel Workbook
A
1C
210
3A
4B
5C
6D
7E
8F
9G
10H
11I
12J
13K
14L
15M
16N
17
Sheet1





The link to the ListPermutationsOrCombinations macro, will produce 1,001 rows like this in another worksheet:


Excel Workbook
A
1A, B, C, D, E, F, G, H, I, J
2A, B, C, D, E, F, G, H, I, K
3A, B, C, D, E, F, G, H, I, L
4A, B, C, D, E, F, G, H, I, M
5A, B, C, D, E, F, G, H, I, N
6A, B, C, D, E, F, G, H, J, K
7A, B, C, D, E, F, G, H, J, L
8A, B, C, D, E, F, G, H, J, M
9A, B, C, D, E, F, G, H, J, N
10A, B, C, D, E, F, G, H, K, L
11A, B, C, D, E, F, G, H, K, M
12A, B, C, D, E, F, G, H, K, N
13A, B, C, D, E, F, G, H, L, M
14A, B, C, D, E, F, G, H, L, N
15A, B, C, D, E, F, G, H, M, N
16A, B, C, D, E, F, G, I, J, K
Sheet3
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,280
Members
452,902
Latest member
Knuddeluff

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