How to assign different probabilities for a lottery?
u/pangu2 - Your post was submitted successfully.
-
Once your problem is solved, reply to the answer(s) saying
Solution Verifiedto close the thread. -
Follow the submission rules -- particularly 1 and 2. To fix the body, click edit. To fix your title, delete and re-post.
-
Include your Excel version and all other relevant information
Failing to follow these steps may result in your post being removed without warning.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
More on reddit.compython - Calculate probability from an excel file - Stack Overflow
Top 10 most frequent numbers in a Lotto excel spreadsheet
Lottery number frequency (example only) analysis via Excel - Stack Overflow
Videos
Hello!
I have a dataset with names and a number. The number is more or less the number of tickets that they hold. So, for example, John 1, and Carl 5. John has 1 ticket, Carl has 5 tickets. Carl has a 5x higher probability of winning the lottery.
How do I run this lottery taking this uneven probability into account? I'm looking for some function or equation that takes already this dataset into account and does all the work.
Or alternatively, or at least it transforms this dataset in a way that duplicates each name based on the amount of tickets. So for instance, the new dataset would be: John, Carl, Carl, Carl, Carl, Carl. This way just selecting at random would still work and take into account the different likelihoods based on ticket number.
I'm using Google Docs. Also due to the way this works, ideally I'd be able to do this with decimals, so "0.5" tickets for example.
Thank you!
So you want an algorithm which returns a random number N between 1 and the total number of tickets (inclusive), and then tells you who holds the Nth ticket in the dataset?
You could generate a number for each name which is the sum total number of tickets for themselves plus everyone else before them in the list, and then find the name corresponding to the maximum individual-total number which was still smaller than N.
Example: You have four names: Alice, Bob, Charlie, and Dani - I'm going to assume you put these in Column A. They have 8,2,5, and 3 tickets respectively (for a sum total of 18 tickets). I'm going to assume these are in Column B, and their totals are in column C. Their matrix looks like this:
| Column A | Column B | Column C |
|---|---|---|
| Alice | 8 | 8 |
| Bob | 2 | 10 |
| Charlie | 5 | 15 |
| Dani | 3 | 18 |
(You can fill column C with "=SUM($B$1:INDIRECT("rc[-1]",0))" if you like; that'll populate it.)
The random roll from 1-18 comes up with "11". Let's see how that plays out:
In D1, put:
=INDEX(A:A,MATCH(1,INDEX(C:C>=11,0),))
This will find the first value in the "C" column which is greater than or equal to 11, which is "15" in row 3. Then it will match that to the corresponding value in the "A" column and spit the correct name out: Charlie.
u/pangu2 - Your post was submitted successfully.
-
Once your problem is solved, reply to the answer(s) saying
Solution Verifiedto close the thread. -
Follow the submission rules -- particularly 1 and 2. To fix the body, click edit. To fix your title, delete and re-post.
-
Include your Excel version and all other relevant information
Failing to follow these steps may result in your post being removed without warning.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
Try this:
=IF($J$1="All",COUNTIF($B$2:$H$5,J2),SUMPRODUCT(--(INDEX(($A$2:$A$5=$J$1)*$B$2:$H$5,)=J2)))

All does a simple COUNTIF.
While Wed/Sat iterates through the columns to find the correct rows and values to return a count.
EDIT: Found a shorter formula.
Have you considered using a countifs statement to count the frequency of balls occurring where the day is equal to Wed and Fri separately? You can then combine them to get the total frequency again. A tutorial is available on their use here: https://exceljet.net/formula/countifs-with-multiple-criteria-and-or-logic
