How to Create a Weighted Random Drawing in Excel
Question details
The user needs to conduct multiple weighted random drawings from a large dataset, selecting a dynamic percentage of unique winners per location based on their varying entry counts.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- Conducting a fair, randomized lottery or raffle where participants have varying numbers of entries, divided across approximately 100 geographic locations.
- Observed behavior
- The goal is to accurately calculate drawing probabilities based on entry weights, select unique winners without duplication, and prevent formula or macro errors when enabling downloaded files.
Ensure your dataset is organized with clear columns for Name ID, Location, and Entry Count, and sort your data by Location to simplify filtering and cumulative calculations.
Use Cumulative Totals and Lookup Formulas
Set up a cumulative total column and use RANDBETWEEN combined with a lookup function to randomly select winners based on their assigned entry weight.
This method creates a range of 'tickets' for each participant. If someone has 5 entries, they occupy 5 numbers in the total pool, giving them a higher probability of being selected by the random number generator.
Assuming Entry Count is in column C starting at C2, add a new 'Cumulative' column in D. In D2, enter =C2. In D3, enter =D2+C3, and drag this formula down to the end of your location group.
In an empty cell (e.g., F2), use the formula =RANDBETWEEN(1, MAX(D:D)) to pick a random 'ticket' number from your cumulative total.
Use a lookup function to find the winning Name ID. In G2, type =XLOOKUP(F2, D2:D10000, A2:A10000, "Not Found", 1). The '1' at the end ensures it finds the exact match or the next larger item, correctly identifying the winner's bracket.
Once a winner is selected, either manually remove their row from the draw pool or add a helper column that sets their entry count to 0 if their Name ID appears in the winner list, then recalculate the cumulative totals.

Automate the Drawing Process with VBA
For massive datasets with 100+ locations, automate the repetitive filtering, weighting, and selection process using a VBA macro.
Easily Manage Weighted Drawings with WPS Spreadsheet
WPS Spreadsheet fully supports advanced functions like XLOOKUP, RANDARRAY, and complex arrays, allowing you to manage massive datasets and weighted raffles with ease—completely for free.
- 1. Open Your Dataset: Launch WPS Spreadsheet and open your .xlsx file containing the raffle entries and locations.
- 2. Calculate Cumulative Entries: Add a cumulative sum column to distribute virtual 'tickets' based on each participant's entry weight.
- 3. Apply Randomizing Functions: Use the RANDBETWEEN function combined with XLOOKUP to instantly draw weighted winners without needing complex programming.

Frequently Asked Questions
Why does my Excel file break when I click 'Enable Content'?
Macros in downloaded files are often blocked by default due to strict security settings. You must unblock the file in Windows File Explorer by right-clicking the file, selecting Properties, checking the 'Unblock' box, and then clicking Apply. Alternatively, move the file to a designated Trusted Location.
How do I prevent the same person from winning twice in a random draw?
After a winner is selected, you must remove them from the active drawing pool. You can do this by manually deleting their row, or by creating a helper column using COUNTIF against your winners list that forces their entry count to 0 once they are selected.
How do I calculate a dynamic 20% winner count per location?
You can use the COUNTIFS function to count the total number of distinct participants at a specific location, then multiply that result by 0.20. Wrap this in a ROUND function (e.g., =ROUND(COUNTIFS(...)*0.2, 0)) to determine the exact number of winners to draw.
Can I do a weighted random draw without VBA?
Yes. Formula-based approaches using cumulative totals, RANDBETWEEN, and XLOOKUP or MATCH functions work perfectly for weighted drawings. However, if you need to perform this separately for 100 different locations, manual formulas will require more setup time compared to an automated VBA script.




