Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Macro to create different groups

Question #1:
I have 8 numbers and wanted to know the different results I could make with
each number paired at least once? In other words, how many different groups
(outcomes/sets) of 2 numbers could be created by using 8 numbers?

1, 2, 3, 4, 5, 6, 7, 8

Results:
1,2 €“ 1,3 €“ 1,4 €“ 1,5 €“ 1,6 - 1,7 €“ 1,8
2,3 €“ 2,4 €“ 2,5 €“ 2,6 €“ 2,7 €“ 2,8
3,4 €“ 3,5 €“ 3,6 €“ 3,7 €“ 3,8
4,5 €“ 4,6 - 4,7 €“ 4,8
5,6 €“ 5,7 - 5-8
6,7 €“ 6,8
7,8

Number of different groups = 28
How can I create a Marco that automatically generates these results?

Question #2:
I have 9 numbers and wanted to know the different results I could make with
each number paired at least once? In other words, how many different groups
(outcomes/sets) of 3 numbers could be created by using 9 numbers?

1, 2, 3, 4, 5, 6, 7, 8, 9

Results:
1,2,3 - 1,2,4 - 1,2,5 - 1,2,6 - 1,2,7 - 1,2,8 - 1,2,9
1,3,4, - 1,3,5, - 1,3,6, - 1,3,7, - 1,3,8, - 1,3,9,
1,4,5 - 1,4,6 - 1,4,7 - 1,4,8 - 1,4,9
1,5,6 - 1,5,7 - 1,5,8 - 1,5,9
1,6,7 - 1,6,8 - 1,6,9
1,7,8 - 1,7,9
1,8,9

2,3,4, - 2,3,5, - 2,3,6, - 2,3,7, - 2,3,8, - 2,3,9
2,4,5 - 2,4,6 - 2,4,7 - 2,4,8 - 2,4,9
2,5,6 - 2,5,7 - 2,5,8 - 2,5,9
2,6,7 - 2,6,8 - 2,6,9
2,7,8 - 2,7,9
2,8,9

3,4,5 - 3,4,6 - 3,4,7 - 3,4,8 - 3,4,9
3,5,6 - 3,5,7 - 3,5,8 - 3,5,9
3,6,7 - 3,6,8 - 3,6,9
3,7,8 - 3,7,9
3,8,9

4,5,6 - 4,5,7 - 4,5,8 - 4,5,9
4,6,7 - 4,6,8 - 4,6,9
4,7,8 - 4,7,9
4,8,9

5,6,7 - 5,6,8 - 5,6,9
5,7,8 - 5,7,9
5,8,9

6,7,8 - 6,7,9
6,8,9

7,8,9

Number of different groups = 84
How can I create a Marco that automatically generates these results?

Question #3:
The next question will be, if I had 12 numbers and wanted to know the
different results I could in groups of three? In other words, how many
different groups (outcomes/sets) of 3 numbers could be created by using 12
numbers?

1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12

Results:
1,2,3 - 1,2,4 - 1,2,5 - 1,2,6 - 1,2,7 - 1,2,8 - 1,2,9 - 1,2,10 - 1,2,11
-1,2,12
1,3,4, - 1,3,5, - 1,3,6, - 1,3,7, - 1,3,8, - 1,3,9, - 1,3,10, - 1,3,11, -
1,3,12,
1,4,5 - 1,4,6 - 1,4,7 - 1,4,8 - 1,4,9 - 1,4,10 - 1,4,11 - 1,4,12
1,5,6 - 1,5,7 - 1,5,8 - 1,5,9 - 1,5,10 - 1,5,11 - 1,5,12
1,6,7 - 1,6,8 - 1,6,9 - 1,6,10 - 1,6,11 - 1,6,12
1,7,8 - 1,7,9 - 1,7,10 - 1,7,11 - 1,7,12
1,8,9 - 1,8,10 - 1,8,11 - 1,8,12
1,9,10 - 1,9,11 - 1,9,12
1,10,11 - 1,10,12
1,11,12

2,3,4, - 2,3,5, - 2,3,6, - 2,3,7, - 2,3,8, - 2,3,9, - 2,3,10, - 2,3,11, -
2,3,12,
2,4,5 - 2,4,6 - 2,4,7 - 2,4,8 - 2,4,9 - 2,4,10 - 2,4,11 - 2,4,12
2,5,6 - 2,5,7 - 2,5,8 - 2,5,9 - 2,5,10 - 2,5,11 - 2,5,12
2,6,7 - 2,6,8 - 2,6,9 - 2,6,10 - 2,6,11 - 2,6,12
2,7,8 - 2,7,9 - 2,7,10 - 2,7,11 - 2,7,12
2,8,9 - 2,8,10 - 2,8,11 - 2,8,12
2,9,10 - 2,9,11 - 2,9,12
2,10,11 - 2,10,12
2,11,12
Number of different groups =
How can I create a Marco that automatically generates these results?


Question #4: And so on€¦€¦€¦€¦.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default Macro to create different groups

No macro needed unless you want a listing of all of the groups of data that
are possible.

n = count of numbers being used
k = # of numbers in each set

# of results = n!/k!(n-k)!

In your first example, n= 8 and k = 2

HTH,
Barb Reinhardt




"Floyd" wrote:

Question #1:
I have 8 numbers and wanted to know the different results I could make with
each number paired at least once? In other words, how many different groups
(outcomes/sets) of 2 numbers could be created by using 8 numbers?

1, 2, 3, 4, 5, 6, 7, 8

Results:
1,2 €“ 1,3 €“ 1,4 €“ 1,5 €“ 1,6 - 1,7 €“ 1,8
2,3 €“ 2,4 €“ 2,5 €“ 2,6 €“ 2,7 €“ 2,8
3,4 €“ 3,5 €“ 3,6 €“ 3,7 €“ 3,8
4,5 €“ 4,6 - 4,7 €“ 4,8
5,6 €“ 5,7 - 5-8
6,7 €“ 6,8
7,8

Number of different groups = 28
How can I create a Marco that automatically generates these results?

Question #2:
I have 9 numbers and wanted to know the different results I could make with
each number paired at least once? In other words, how many different groups
(outcomes/sets) of 3 numbers could be created by using 9 numbers?

1, 2, 3, 4, 5, 6, 7, 8, 9

Results:
1,2,3 - 1,2,4 - 1,2,5 - 1,2,6 - 1,2,7 - 1,2,8 - 1,2,9
1,3,4, - 1,3,5, - 1,3,6, - 1,3,7, - 1,3,8, - 1,3,9,
1,4,5 - 1,4,6 - 1,4,7 - 1,4,8 - 1,4,9
1,5,6 - 1,5,7 - 1,5,8 - 1,5,9
1,6,7 - 1,6,8 - 1,6,9
1,7,8 - 1,7,9
1,8,9

2,3,4, - 2,3,5, - 2,3,6, - 2,3,7, - 2,3,8, - 2,3,9
2,4,5 - 2,4,6 - 2,4,7 - 2,4,8 - 2,4,9
2,5,6 - 2,5,7 - 2,5,8 - 2,5,9
2,6,7 - 2,6,8 - 2,6,9
2,7,8 - 2,7,9
2,8,9

3,4,5 - 3,4,6 - 3,4,7 - 3,4,8 - 3,4,9
3,5,6 - 3,5,7 - 3,5,8 - 3,5,9
3,6,7 - 3,6,8 - 3,6,9
3,7,8 - 3,7,9
3,8,9

4,5,6 - 4,5,7 - 4,5,8 - 4,5,9
4,6,7 - 4,6,8 - 4,6,9
4,7,8 - 4,7,9
4,8,9

5,6,7 - 5,6,8 - 5,6,9
5,7,8 - 5,7,9
5,8,9

6,7,8 - 6,7,9
6,8,9

7,8,9

Number of different groups = 84
How can I create a Marco that automatically generates these results?

Question #3:
The next question will be, if I had 12 numbers and wanted to know the
different results I could in groups of three? In other words, how many
different groups (outcomes/sets) of 3 numbers could be created by using 12
numbers?

1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12

Results:
1,2,3 - 1,2,4 - 1,2,5 - 1,2,6 - 1,2,7 - 1,2,8 - 1,2,9 - 1,2,10 - 1,2,11
-1,2,12
1,3,4, - 1,3,5, - 1,3,6, - 1,3,7, - 1,3,8, - 1,3,9, - 1,3,10, - 1,3,11, -
1,3,12,
1,4,5 - 1,4,6 - 1,4,7 - 1,4,8 - 1,4,9 - 1,4,10 - 1,4,11 - 1,4,12
1,5,6 - 1,5,7 - 1,5,8 - 1,5,9 - 1,5,10 - 1,5,11 - 1,5,12
1,6,7 - 1,6,8 - 1,6,9 - 1,6,10 - 1,6,11 - 1,6,12
1,7,8 - 1,7,9 - 1,7,10 - 1,7,11 - 1,7,12
1,8,9 - 1,8,10 - 1,8,11 - 1,8,12
1,9,10 - 1,9,11 - 1,9,12
1,10,11 - 1,10,12
1,11,12

2,3,4, - 2,3,5, - 2,3,6, - 2,3,7, - 2,3,8, - 2,3,9, - 2,3,10, - 2,3,11, -
2,3,12,
2,4,5 - 2,4,6 - 2,4,7 - 2,4,8 - 2,4,9 - 2,4,10 - 2,4,11 - 2,4,12
2,5,6 - 2,5,7 - 2,5,8 - 2,5,9 - 2,5,10 - 2,5,11 - 2,5,12
2,6,7 - 2,6,8 - 2,6,9 - 2,6,10 - 2,6,11 - 2,6,12
2,7,8 - 2,7,9 - 2,7,10 - 2,7,11 - 2,7,12
2,8,9 - 2,8,10 - 2,8,11 - 2,8,12
2,9,10 - 2,9,11 - 2,9,12
2,10,11 - 2,10,12
2,11,12
Number of different groups =
How can I create a Marco that automatically generates these results?


Question #4: And so on€¦€¦€¦€¦.

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
Create groups based on measure in pivot hedgehog Charts and Charting in Excel 0 September 1st 09 09:12 AM
how can I create different groups in Excel? Katerina Excel Worksheet Functions 2 December 2nd 08 06:44 PM
How to create groups of several rows in sheet (excel)? MIB New Users to Excel 2 September 8th 08 02:22 PM
Create a formula to rearrange different values in groups Raymond L[_2_] Excel Discussion (Misc queries) 2 April 28th 08 12:33 AM
how to create sub-groups within a main group decipherZ Excel Discussion (Misc queries) 0 February 15th 06 02:27 AM


All times are GMT +1. The time now is 08:19 PM.

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

About Us

"It's about Microsoft Excel"