# Excell Formula ???

#### Sandman

##### Member
Can anyone with Excell Knowledge provide me with the formula to give me all 6 number combo's using 15 numbers??
GillesD I know is an Excell Genius and has helped out in the past.
Thanx.

#### jbiff

##### Member
not sure how to link within this board
but GillesD provides some VBA code that can be manipulated to fit your needs I think

The above is an atempted link to the code
if it don't work just use the board search function for "Excel documentation" it gives me one result and scroll half way down and you'll find it...otherwise just use Complete Wheel Designer and use cut'n'paste...its free and its good

Later on, hope it helps
have a cold one for me
Biff

#### GillesD

##### Member
Combinations 6 out of 15

In Excel, in Cells A1 to A15, place (preferably in ascending order) the 15 numbers you want to combine. Then run the VBA program listed below. You will get in Column C the combination number (from 1 to 5005), then in Columns D to I, the values for N1, N2, …, N6 for each of those combinations.

Option Explicit
Option Base 1
Sub Combin_15x6()
Dim A As Integer, B As Integer, C As Integer
Dim D As Integer, E As Integer, F As Integer
Dim I As Integer, vN(15) As Integer
Application.ScreenUpdating = False
Range("A1").Select
For I = 1 To 15
vN(I) = ActiveCell.Value
ActiveCell.Offset(1, 0).Select
Next I
Range("C1").Select
I = 1
For A = 1 To 10
For B = A + 1 To 11
For C = B + 1 To 12
For D = C + 1 To 13
For E = D + 1 To 14
For F = E + 1 To 15
ActiveCell.Offset(0, 0).Value = I
ActiveCell.Offset(0, 1).Value = vN(A)
ActiveCell.Offset(0, 2).Value = vN(B)
ActiveCell.Offset(0, 3).Value = vN(C)
ActiveCell.Offset(0, 4).Value = vN(D)
ActiveCell.Offset(0, 5).Value = vN(E)
ActiveCell.Offset(0, 6).Value = vN(F)
I = I + 1
ActiveCell.Offset(1, 0).Select
Next F
Next E
Next D
Next C
Next B
Next A
Range("A1").Select
End Sub