Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default permutations/combinations

For modeling purposes in need all posible combination to split 8-512 points
in half (50% training, 50% testing). So for instance 10 points, how many
times can I make unique combinations of 5 by 5. The result file should have
in the fist column the number of the combination, and in the second the
order e.g.

1 1
1 2
1 3
1 4
1 5
1 6
1 7
1 8
1 9
1 10
2 10
2 1
2 2
2 3
2 4
2 5
2 6
2 7
2 8
2 9
3
..
etc.

Any help is appreciated, regards,

Niels


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default permutations/combinations

sub 10points()
rw = 1
for i = 1 to 10
for j = 1 to 10
cells(rw,1) = i : cells(rw,2) = j
rw = rw + 1
next
next
end sub

--
Regards,
Tom Ogilvy


"Niels" wrote:

For modeling purposes in need all posible combination to split 8-512 points
in half (50% training, 50% testing). So for instance 10 points, how many
times can I make unique combinations of 5 by 5. The result file should have
in the fist column the number of the combination, and in the second the
order e.g.

1 1
1 2
1 3
1 4
1 5
1 6
1 7
1 8
1 9
1 10
2 10
2 1
2 2
2 3
2 4
2 5
2 6
2 7
2 8
2 9
3
..
etc.

Any help is appreciated, regards,

Niels



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default permutations/combinations

Tom,

I tested your script, but this does not schange the order in the second
column. I already found out that I need a max of 999 combinations (see reply
Bernie Deitrick). So for 4 points the file would have to look like this:

1 1
1 2
1 3
1 4
2 1
2 3
2 2
2 4
3 1
3 4
3 2
3 3

regards,

Niels

"Tom Ogilvy" wrote in message
...
sub 10points()
rw = 1
for i = 1 to 10
for j = 1 to 10
cells(rw,1) = i : cells(rw,2) = j
rw = rw + 1
next
next
end sub

--
Regards,
Tom Ogilvy


"Niels" wrote:

For modeling purposes in need all posible combination to split 8-512
points
in half (50% training, 50% testing). So for instance 10 points, how many
times can I make unique combinations of 5 by 5. The result file should
have
in the fist column the number of the combination, and in the second the
order e.g.

1 1
1 2
1 3
1 4
1 5
1 6
1 7
1 8
1 9
1 10
2 10
2 1
2 2
2 3
2 4
2 5
2 6
2 7
2 8
2 9
3
..
etc.

Any help is appreciated, regards,

Niels





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default permutations/combinations

Niels,

=COMBIN(#,#/2)/2

So, for 4 points, there are 3 unique splits:

1 2 3 4
1 3 2 4
1 4 2 3

unless order is important, then use

=COMBIN(#,#/2)

But note that there are
2.36x10^152
unique ways to split 512 points, so doubt you'll be able to deal with all possible combinations.

HTH,
Bernie
MS Excel MVP


"Niels" wrote in message ...
For modeling purposes in need all posible combination to split 8-512 points in half (50% training,
50% testing). So for instance 10 points, how many times can I make unique combinations of 5 by 5.
The result file should have in the fist column the number of the combination, and in the second
the order e.g.

1 1
1 2
1 3
1 4
1 5
1 6
1 7
1 8
1 9
1 10
2 10
2 1
2 2
2 3
2 4
2 5
2 6
2 7
2 8
2 9
3
.
etc.

Any help is appreciated, regards,

Niels



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default permutations/combinations

Bernie,

Thanks for the tip, so it seems that I have to set the upper limit to 999
combinations. But, the below mentioned formula just gives the number of
posible combinations, but I also need the file described below. It is used
in modeling software which uses the first 50% for model building and the
second 50% for testing. Once I have all combinations written out I use
lookup functions to fill the values. So for the 4 points you describe below
it would look like this:

1 1
1 2
1 3
1 4
2 1
2 3
2 2
2 4
3 1
3 4
3 2
3 3

Can I easily produce such file with a threshold of max 999 combinations?
Regards,

Niels

"Bernie Deitrick" <deitbe @ consumer dot org wrote in message
...
Niels,

=COMBIN(#,#/2)/2

So, for 4 points, there are 3 unique splits:

1 2 3 4
1 3 2 4
1 4 2 3

unless order is important, then use

=COMBIN(#,#/2)

But note that there are
2.36x10^152
unique ways to split 512 points, so doubt you'll be able to deal with all
possible combinations.

HTH,
Bernie
MS Excel MVP


"Niels" wrote in message
...
For modeling purposes in need all posible combination to split 8-512
points in half (50% training, 50% testing). So for instance 10 points,
how many times can I make unique combinations of 5 by 5. The result file
should have in the fist column the number of the combination, and in the
second the order e.g.

1 1
1 2
1 3
1 4
1 5
1 6
1 7
1 8
1 9
1 10
2 10
2 1
2 2
2 3
2 4
2 5
2 6
2 7
2 8
2 9
3
.
etc. till max. 999

Any help is appreciated, regards,

Niels







  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default permutations/combinations

Does order matter? Because if it does, you could really have:

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



Or does only grouping (1st half/2nd half) matter? In which case:

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

Or does only pairing and order matter? In which case:

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

Or does only pairing matter? In which case:

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

Bernie
MS Excel MVP


"Niels" wrote in message ...
Bernie,

Thanks for the tip, so it seems that I have to set the upper limit to 999 combinations. But, the
below mentioned formula just gives the number of posible combinations, but I also need the file
described below. It is used in modeling software which uses the first 50% for model building and
the second 50% for testing. Once I have all combinations written out I use lookup functions to
fill the values. So for the 4 points you describe below it would look like this:

1 1
1 2
1 3
1 4
2 1
2 3
2 2
2 4
3 1
3 4
3 2
3 3

Can I easily produce such file with a threshold of max 999 combinations? Regards,

Niels

"Bernie Deitrick" <deitbe @ consumer dot org wrote in message
...
Niels,

=COMBIN(#,#/2)/2

So, for 4 points, there are 3 unique splits:

1 2 3 4
1 3 2 4
1 4 2 3

unless order is important, then use

=COMBIN(#,#/2)

But note that there are
2.36x10^152
unique ways to split 512 points, so doubt you'll be able to deal with all possible combinations.

HTH,
Bernie
MS Excel MVP


"Niels" wrote in message
...
For modeling purposes in need all posible combination to split 8-512 points in half (50%
training, 50% testing). So for instance 10 points, how many times can I make unique combinations
of 5 by 5. The result file should have in the fist column the number of the combination, and in
the second the order e.g.

1 1
1 2
1 3
1 4
1 5
1 6
1 7
1 8
1 9
1 10
2 10
2 1
2 2
2 3
2 4
2 5
2 6
2 7
2 8
2 9
3
.
etc. till max. 999

Any help is appreciated, regards,

Niels







  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default permutations/combinations

Only grouping (1st half/2nd half) matters to a max. of 999 combinations, so:

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


Niels

"Bernie Deitrick" <deitbe @ consumer dot org wrote in message
...
Does order matter? Because if it does, you could really have:

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



Or does only grouping (1st half/2nd half) matter? In which case:

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

Or does only pairing and order matter? In which case:

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

Or does only pairing matter? In which case:

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

Bernie
MS Excel MVP


"Niels" wrote in message
...
Bernie,

Thanks for the tip, so it seems that I have to set the upper limit to 999
combinations. But, the below mentioned formula just gives the number of
posible combinations, but I also need the file described below. It is
used in modeling software which uses the first 50% for model building and
the second 50% for testing. Once I have all combinations written out I
use lookup functions to fill the values. So for the 4 points you describe
below it would look like this:

1 1
1 2
1 3
1 4
2 1
2 3
2 2
2 4
3 1
3 4
3 2
3 3

Can I easily produce such file with a threshold of max 999 combinations?
Regards,

Niels

"Bernie Deitrick" <deitbe @ consumer dot org wrote in message
...
Niels,

=COMBIN(#,#/2)/2

So, for 4 points, there are 3 unique splits:

1 2 3 4
1 3 2 4
1 4 2 3

unless order is important, then use

=COMBIN(#,#/2)

But note that there are
2.36x10^152
unique ways to split 512 points, so doubt you'll be able to deal with
all possible combinations.

HTH,
Bernie
MS Excel MVP


"Niels" wrote in message
...
For modeling purposes in need all posible combination to split 8-512
points in half (50% training, 50% testing). So for instance 10 points,
how many times can I make unique combinations of 5 by 5. The result
file should have in the fist column the number of the combination, and
in the second the order e.g.

1 1
1 2
1 3
1 4
1 5
1 6
1 7
1 8
1 9
1 10
2 10
2 1
2 2
2 3
2 4
2 5
2 6
2 7
2 8
2 9
3
.
etc. till max. 999

Any help is appreciated, regards,

Niels









  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default permutations/combinations

Niels,

I'm sorry - one more clarification. I mixed up my examples, and really shouldn't have included the
second group that you included in your reply - that example also uses order. Do you want to see
both

1, 2, 3, 4
and
2, 1, 3, 4

or just

1, 2, 3, 4

so that the complete set would be

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


Sorry about that,
Bernie
MS Excel MVP


"Niels" wrote in message ...
Only grouping (1st half/2nd half) matters to a max. of 999 combinations, so:

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


Niels

"Bernie Deitrick" <deitbe @ consumer dot org wrote in message
...
Does order matter? Because if it does, you could really have:

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



Or does only grouping (1st half/2nd half) matter? In which case:

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

Or does only pairing and order matter? In which case:

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

Or does only pairing matter? In which case:

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

Bernie
MS Excel MVP


"Niels" wrote in message
...
Bernie,

Thanks for the tip, so it seems that I have to set the upper limit to 999 combinations. But, the
below mentioned formula just gives the number of posible combinations, but I also need the file
described below. It is used in modeling software which uses the first 50% for model building
and the second 50% for testing. Once I have all combinations written out I use lookup functions
to fill the values. So for the 4 points you describe below it would look like this:

1 1
1 2
1 3
1 4
2 1
2 3
2 2
2 4
3 1
3 4
3 2
3 3

Can I easily produce such file with a threshold of max 999 combinations? Regards,

Niels

"Bernie Deitrick" <deitbe @ consumer dot org wrote in message
...
Niels,

=COMBIN(#,#/2)/2

So, for 4 points, there are 3 unique splits:

1 2 3 4
1 3 2 4
1 4 2 3

unless order is important, then use

=COMBIN(#,#/2)

But note that there are
2.36x10^152
unique ways to split 512 points, so doubt you'll be able to deal with all possible
combinations.

HTH,
Bernie
MS Excel MVP


"Niels" wrote in message
...
For modeling purposes in need all posible combination to split 8-512 points in half (50%
training, 50% testing). So for instance 10 points, how many times can I make unique
combinations of 5 by 5. The result file should have in the fist column the number of the
combination, and in the second the order e.g.

1 1
1 2
1 3
1 4
1 5
1 6
1 7
1 8
1 9
1 10
2 10
2 1
2 2
2 3
2 4
2 5
2 6
2 7
2 8
2 9
3
.
etc. till max. 999

Any help is appreciated, regards,

Niels











Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to create a list of permutations and combinations? Malcolm Excel Discussion (Misc queries) 3 May 20th 23 03:44 AM
How to create a macro in excel so that it can generate a list ofunique records using all permutations and combinations of the data in eachrow ad column Rizwan[_4_] Excel Discussion (Misc queries) 1 August 6th 09 01:44 PM
Permutations Dave Excel Discussion (Misc queries) 5 July 23rd 07 03:06 PM
Permutations or Combinations or some other function?? Mark Siler Excel Discussion (Misc queries) 4 December 23rd 06 04:22 PM
Permutations Henrik Excel Programming 3 December 2nd 04 05:32 AM


All times are GMT +1. The time now is 06:54 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"