ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   combinatiion of 6 digit numbers from 0-49 (https://www.excelbanter.com/excel-discussion-misc-queries/132304-combinatiion-6-digit-numbers-0-49-a.html)

Divya

combinatiion of 6 digit numbers from 0-49
 
kindly tell me how do i get the various combinations of six digit number from
0-49.The number should not be repeated in any of the combinations

Max

combinatiion of 6 digit numbers from 0-49
 
"Divya" wrote:
kindly tell me how do i get the various combinations of six digit number from
0-49.The number should not be repeated in any of the combinations


One way is to use Myrna Larson's power subroutine ..

Try this sample from my archives which contains an implementation:
http://www.savefile.com/files/518493
MyrnaLarson_Combination_Permutation.xls
(full details inside, ready to go <g)

In the sample file,
In Sheet1,
1. Enter the letter C or P in A1 (C = combinations, P = permutations), ie
enter: C
2. Enter the number of items involved per combo in A2, ie enter: 6
3. Enter/List the 50 items in A3 down, ie list in A3:A52: 0, 1, 2, ... 49
4. Select A1 (this selection is required), then click the button
ListPermutations to run the sub ListPermutations
5. The results will be written to a new sheet (just to the left), and appear
like below, in a zig-zag manner until all combos are exhausted:

0, 1, 2, 3, 4, 5
0, 1, 2, 3, 4, 6
0, 1, 2, 3, 4, 7
.....
.....

Note that what you want generated is a "Pick 6 out of 50",
which works out to a staggering:
=COMBIN(50,6) = 15,890,700 combos

As a single sheet in xl97 to xl2003 houses:
=65536 rows x 256 cols = 16,777,216 cells

so almost the entire sheet would be populated
when you run your "Pick 6 out of 50"

The sub would certainly need time to complete its run/generation

For a start, suggest that you go easy on the number of combos, maybe run a
"Pick 2 out of 50" first, ie enter in A2: 2, instead of 6, then click the
button. You should see all 1225 combos [=COMBIN(50,2)] generated in Sheet2
--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---


All times are GMT +1. The time now is 07:42 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com