Names out of a hat in excel

jworkman7

Board Regular
Joined
Jul 1, 2015
Messages
50
I have a worksheet which lists down column A, a number of employee names. In Column B, it lists the total number of inter-department referrals each employee has referred to someone else to generate sales.

I'd like to do a drawing which would randomly select a name, taking into account the number of referrals each person has. I realize I can use the RAND function easy enough to generate random numbers, but how can I make this work so that the probability is enhanced to favor those with more entries in the drawing?
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Here's one option:

Excel 2010
ABCDE
1NamesReferrals
2Al2212Cindy
3Bob35
4Cindy712
5Diane214
6Eric418
7Frank1129
8Gail433
9Harriet639
10

<colgroup><col style="width: 25pxpx"><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet3

Worksheet Formulas
CellFormula
C2=SUM($B$2:B2)
D2=RANDBETWEEN(1,SUM(B2:B9))

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>

Array Formulas
CellFormula
E2{=INDEX(A1:A9,MIN(IF(D2<=$C$2:$C$9,ROW($C$2:$C$9))))}

<thead>
</thead><tbody>
</tbody>
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}.
Note: Do not try and enter the {} manually yourself

<tbody>
</tbody>



The helper column in C shows the sum so far of total referrals, with the value in C9 being the total value. Then the formula in D2 calculates a random number between 1 and the total number of referrals. Finally, the E2 formula converts the D2 value to a name. In this example, 1 and 2 translate to Al, 3, 4, and 5 translate to Bob, 6-12 translate to Cindy, etc. It's not real elegant, but it works. You can do multiple drawings by pressing F9.

Let me know if this helps.
 
Upvote 0
Hi Eric W, this will work great. Thanks for taking the time to put this together! I'll save it for future use.
 
Upvote 0

Forum statistics

Threads
1,215,563
Messages
6,125,572
Members
449,237
Latest member
Chase S

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