lottery teaser

irishbantam

New Member
Joined
Dec 1, 2005
Messages
5
Hi can someone explain how I can output values in a 1 to 49, 6 number lottery. The formula n!/k!(n-k)! will only give me th odds , not the 13800000 approx outputs

irish bantam
 

Some videos you may like

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.

bandit_1981

Board Regular
Joined
Aug 17, 2005
Messages
201
Here is a cheap way todo it in VBA.

Code:
Dim MyValue As Long
Dim x As Long
Dim Numlist As String

Randomize   ' Initialize random-number generator.


For x = 1 To 6
    MyValue = Int((49 * Rnd) + 1)   ' Generate random value between 1 and 49.
    If x <> 6 Then
        Numlist = Numlist & MyValue & ","
    Else
        Numlist = Numlist & MyValue
    End If
Next

Range("A1") = Numlist

The output will be like this 2,45,34,17,39,49
 

Watch MrExcel Video

Forum statistics

Threads
1,118,069
Messages
5,570,014
Members
412,304
Latest member
citrus
Top