Solved

how many combinations of three numbers can be found in any given quantity

Posted on 2013-02-04
12
302 Views
Last Modified: 2013-02-13
I have to work out and write down (on a spreadsheet):

how many groups of three numbers can be extracted (without repetition) from 80.

as an illustration:

there is only one group of three numbers in 3 (1,2,3)
there are four groups of three numbers in 4 (1,2,3  1,2,4  1,3,4  2,3,4)
there are 10 groups of three numbers in 6 (see attached worksheet)

I hope this calculation makes sense.

I need help with the formula for determining how many combinations, but in addition I also need them written out in a spreadsheet in an ordered way similar to that arranged in the attached worksheet.

I would be very grateful for help
sample-3.xls
0
Comment
Question by:MichaelGlancy
  • 5
  • 3
  • 3
  • +1
12 Comments
 

Author Comment

by:MichaelGlancy
ID: 38852272
I have =COMBIN(80, 3) for excel which gives me 18,424 possibilities

Now, what would be great would be a way of listing them all out in order.

1 2 3  (each number to its own cell)
1 2 4
1 2 5
1 2 6.... etc
0
 
LVL 27

Expert Comment

by:d-glitch
ID: 38852277
For N numbers:  (N!) divided by (N-3)!*3!
0
 

Author Comment

by:MichaelGlancy
ID: 38852289
thankyou d-glitch, I have that already

I need some sort of code that will list them out, so that I can count the occurrence of combinations in a sample
0
The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

 
LVL 27

Expert Comment

by:d-glitch
ID: 38852299
No easy way to do that in Excel.  You need a programming language like AWK or Perl.
0
 
LVL 44

Expert Comment

by:Arthur_Wood
ID: 38852363
since there are 164,320 sets of 3 numbers in the result set, that will be quite a challenge to list each set in Excel.

AW
0
 

Author Comment

by:MichaelGlancy
ID: 38852382
Does Excel have a limit to the amount it can work with ?
0
 
LVL 27

Expert Comment

by:d-glitch
ID: 38852410
If you have a programming language and an 80-element array,  you can do it with three nested loops:

   For i = 1 to 80
       For j = i to 80
          For k = j to 80
          Print   Array( i), Array( j), Array( k)
          next k
       next j
   next i
0
 
LVL 37

Expert Comment

by:TommySzalapski
ID: 38852412
Arthur, it's 3! not 3 in the denominator. So there's only 82,160 possibilities.
I don't see why Excel could not handle that. It might take a bit longer than other languages, but I can't imagine it running any longer than a minute. It could be done with either VBA (fairly simple) or formulas (a bit harder).

Does the assignment specify which you need to use?
0
 
LVL 37

Expert Comment

by:TommySzalapski
ID: 38852426
Or since it's not an array and it's just numbers, you could just do.

row = 1;
 For i = 1 to 78
       For j = i+1 to 79
          For k = j +1to 80
            Range("A"&row).Value = i
            Range("B"&row).Value = j
            Range("C"&row).Value = k
            row = row + 1
          next k
       next j
   next i

Open in new window

0
 
LVL 27

Expert Comment

by:d-glitch
ID: 38852427
>> Does Excel have a limit to the amount it can work with ?

Yes.  64k rows and 256 columns.  
That is plenty of space.  The problem is the available tools.
0
 
LVL 27

Accepted Solution

by:
d-glitch earned 500 total points
ID: 38852433
Correction for the program ...

  For i = 1 to 80
       For j = i+1 to 80
          For k = j+1 to 80
          Print   Array( i), Array( j), Array( k)
          next k
       next j
   next i
0
 
LVL 37

Expert Comment

by:TommySzalapski
ID: 38852441
64k is Excel 2003. The later ones will handle the 82160 just fine.
And lose the semicolon in the first line of my code
Also, combin(80,3) should give 82160 which is what I calculated earlier.
0

Featured Post

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
How to get Spreadsheet Compare 2016 working with the 64 bit version of Office 2016
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question