Combination from Lexicographic Number

Kenya649

Member
How can I know the combination of 6 numbers from 49 if I'm given the lexicographic numbers say 3,567,957.

Any idea from Excel Macro is highly appreciated.

Thanks
 

Gonga

Member
Lexicographical Decoder

This is not an Excel Macro, but have you tried E.A.L
http://www.slx.za.net/rtfm/eal/addons/user_dbase_04.html

You can download E.A.L here
http://www.slx.za.net/toys.html
 

Frank

Member
The following macro (originally written by GillesD) does the job. It just goes through all combinations until it reaches the lex value that is entered in cell A1. It then places the numbers N1 to N6 in cells B1 to G1.



Listing for the macro LexToNumbers:



Sub LexToNumbers()
nVal = Range("A1").Value
nLex = 0
For A = 1 To 44
For B = A + 1 To 45
For C = B + 1 To 46
For D = C + 1 To 47
For E = D + 1 To 48
For F = E + 1 To 49
nLex = nLex + 1
If nLex = nVal Then
Range("B1").Value = A
Range("C1").Value = B
Range("D1").Value = C
Range("E1").Value = D
Range("F1").Value = E
Range("G1").Value = F
Exit Sub
End If
Next F
Next E
Next D
Next C
Next B
Next A
End Sub

There is also a discussion of a more complicated method of using formulas in this thread, its for 5/56 but the concept is the same.

http://www.lotto649.ws/questions-answers/12452-combination-lexicographix-number.html
 

Sidebar

Top