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
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
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
 
Upvote 0

Forum statistics

Threads
1,215,773
Messages
6,126,821
Members
449,340
Latest member
hpm23

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