Permutations

howard

Well-known Member
Joined
Jun 26, 2006
Messages
6,570
Office Version
  1. 2021
Platform
  1. Windows
I have a series of numbers in an excel spreadsheet for eg 6, 11,7,28,23,28,45,47,41,35,38
where I want to determine the number permutations.

The criteria is as follows:

1) The maximum number number in any row/cell is 6 for eg 1, 18, 23, 38, 45, 49

2) No number must occur more than once in a cell for eg the number 11, 11 must now be allowed


It would be appreciated if you would provide me wth VBA code that will allow me to do the above

Once the Macro has been activated the data should look similar to this

11, 7, 17, 28, 23, 28
11, 7, 17, 28, 23, 45
11, 7, 17, 28, 23, 47

Howard
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
Hi
I thought I had replied this mail.
11P6 = 11*10*9*8*7*6 = 332640 permutations. will spread over 36 columns spanning 1 to 65536 rows. If you confirm that this is what you are looking for, I will write codes suitably on hearing from you
Ravi
 
Upvote 0
Permuations

Hi Ravi

Thanks for your response.

I would like a maximum of 6 permutations. I would like the code to be flexible so as to allow me to enter the number of permuations.

Thanks

Howard
 
Upvote 0
Your formula = n!/(n-r)!

In other words: 45!/39!

where you have 45 numbers to choose from and looking to pick 6 (similar to that of a lotto ;))
 
Upvote 0
Hi Ravi

Thats exactly what I am looking for. I did permutations in Statistics a number of years ago, but have forgotten how to do calculate it and I don't use Stats at work.

Your assistance will be most appreciated

Regards

howard
 
Upvote 0
Howard, do you get what Ravi is saying? In that there will be 332640 number of permutations for what you are asking.
 
Upvote 0
Is it possible to limit the number of permutations to 15? If so I would like flexibility built into the code which will allow me to select the number of permutations to a maximum of 100


Regards

Howard
 
Upvote 0
HI
Select any 15 or 100 of the nearly 0.3 million choices? I would like to know what you are trying to do so that we can tailor the macro to do only that. is it some sort of Randomizing a set of numbers?
Ravi
 
Upvote 0
Hi Ravi

I would like pick six numbers from a series of say 12 numbers and work out the permutations, but limit this to a maximum of 15 possible permutations.

for eg if numbers are 1,11,15,23,28,31,35,38,41,43,45,49-then extract 15 possible permutations from these numbers

for eg 1, 23, 35, 38, 45, 49
1, 15, 23, 41, 43, 45 etc until there are 15 permutations

Your assistance in this regard will be most appreciated

Regards

Howard
 
Upvote 0
Hi Ravi

Have you managed to let at writing code that will assist me in generating a maximum of 15 permutations based?

I would like to input 12 numbers and I would like Excel to generate 15 permutations of 6 numbers per cell

for eg 1,11, 15, 18, 26, 38 (1 permutation)
1, 18, 25, 30, 36, 48 (2nd permutation) etc


Your assistance will be most appreciated


Regards

Howard
 
Upvote 0

Forum statistics

Threads
1,216,477
Messages
6,130,880
Members
449,603
Latest member
dizze90

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top