View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Gary's Student Gary's Student is offline
external usenet poster
 
Posts: 86
Default Generate table of combinations

Can anyone point me to an algorithm or VBA code to produce a table of
combination of items. For example if the items are 1,2,3,4,5 then the code
would generate:

1
1, 2
1, 2, 3
1, 2, 3, 4
1, 2, 3, 5
1, 2, 3, 4, 5
1, 2, 4
1, 2, 4, 5
1, 2, 5
1, 3
1, 3, 4
1, 3, 4, 5
1, 3, 5
1, 4
1, 4, 5
1, 5
2
2, 3
2, 3, 4
2, 3, 4, 5
2, 3, 5
2, 4
2, 4, 5
2, 5
3
3, 4
3, 4, 5
3, 5
4
4, 5
5

Similar for dog, cat, house
--
Gary's Student