Forum Discussion
Random selection for raffle winners
- Oct 06, 2020With your permission, if I can recommend you, add a file (without sensitive data) to your project.
Explain your plans in relation to this file.
So you can get a solution that is tailored to your needs much faster.
At the same time, it is much easier for someone who wants to help to understand the subject.
A win-win situation for everyone.
Here is a VBA suggestion.
The list of names in column A can be of any length, but must begin in A1.
The second macro builds in the button to trigger the first macro.
Code:
Sub raffle ()
Dim rngBer As Range
Dim lngZ As Long
Randomize
lngZ = Cells (Rows.Count, 1) .End (xlUp) .Row
Set rngBer = Range (Cells (1, 1), Cells (lngZ, 1))
lngZ = CLng (Int (lngZ * Rnd + 1))
Cells (lngZ, 1) .Offset (0, 1) .Value = Cells (lngZ, 1) .Offset (0, 1) .Value + 1
End Sub
'************************************************* *
Sub button ()
With ActiveSheet.Buttons.Add (243, 24, 104.25, 45)
.OnAction = "Raffle"
.Characters.Text = "Start"
End With
End Sub
If you click the button with the right mouse button, you can move it to any position.I would be happy to know if I could help.
Nikolino
I know I don't know anything (Socrates)
JMB17 Hi again. Using Random.org was a good idea. Since I am trying to replicate the drawing of winners for 5 prizes, I used the Integer generator using 5 sets (5 draws) with one unique integer. I think this replicates how a raffle draw would work the best. Probably even better because often when you do raffle draws a person can win more than once. Could you confirm my thinking is correct. Very useful having someone to bounce things off.
And with the horse program, I am doing 4 sets of 24 horses (96 tickets) as this is how a sweep would work in the physical world.
Once again, many many thanks for your help. I have learnt so much...Maree
If you were drawing numbers out of a hat, are you putting the number that was drawn back in the hat?
If they can win more than once on the same ticket, then I think 5 sets of 1 number would be correct. If they cannot win more than once on the same ticket, then I think 1 set of 5 unique numbers would be correct.
- JMB17Nov 01, 2020Bronze ContributorI'm glad you have it sorted out and good luck with your event!
- Maree29Nov 01, 2020Copper Contributor
JMB17 Thankyou for being so quick to respond.
Each ticket is unique and a person can buy multiple tickets.
Therefore 1 set of 5 numbers is the way to go.
JMB you have been wonderful. Not sure if against the rules but can you tell me your first name. If so I can publicly recognise you for your input. I don't even know if you are in Australia, but if you are, you will know about the Melbourne Cup.
Regards
Maree