Extract numbers in Combinations of 6

howard

Well-known Member
Joined
Jun 26, 2006
Messages
6,561
Office Version
  1. 2021
Platform
  1. Windows
I have a range of numbers in A1:F6

I need a formula or VBA to extract all possible combinations (6 numbers at a time) and place these in A11 onwards containing 6 numbers in each row

See sample data as well as what I am trying to achieve



I have also posted on



It would be appreciated if someone could provide me with a solution to the above
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
I would suggest making your request a bit clearer to avoid any confusion as to what is required.

In your cross post it was pointed out that there could be around 5 million results with a sample of 16 numbers.

With the sample here containing 16 numbers and the first example result showing a number being duplicated, you are potentially looking at a much higher number of results (possibly as high as 5,000,000,000 results) which would need 5000 sheets of data if you only use columns A:F for the results!

You might get some answers to this, but I don't think that a solution will be possible without a better thought out question.
 
Upvote 0
Let's try to simplify this a bit. Assuming that the sample contains all numbers from 1 to 10 (with 1 being in the sample twice).

Should 1,2,3,4,5,6 and 6,5,4,3,2,1 both be shown in the results, or just 1,2,3,4,5,6?

Is 1,1,2,3,4,5 a valid result?
 
Upvote 0
Thanks for the reply

I only need to see one result for eg 1,2,3,4,5,6.

1,1,2,3,4,5 is a valid result
 
Upvote 0
Trying to make something work with your data sample is going to be a bit of a tall order. I would suggest that you look at one of the readily avaliable lottery combination generators (google) for a 6 number draw.

If you can find one that will take numbers from a range of cells rather than a pre-defined number set then that will do exactly what you want, but I expect that it will be a case of pairing the lottery numbers drawn with the numbers in your data set to make it work properly.
 
Upvote 0

Forum statistics

Threads
1,214,979
Messages
6,122,552
Members
449,088
Latest member
davidcom

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