random assignment

Mbouas

New Member
Joined
Apr 9, 2018
Messages
3
Hello
i have 1001 individuals in my dataset, i would like to assign randomly to each one "owner" and "non_owner". knowing that after the random assignement i should have 71% owner and 29% non-owner. is it possible with excel?
thank you for your help
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
Say your names are in Column A from A1:A1001.

In B1 put =Rand() and copy down to B1001

Then Copy B1:B1001 and paste special Values so the B column random values are fixed.

Then in C1 put
<LARGE($B$1:$b$1001,int(0.29*1001)),"owner","non-owner")"
<LARGE($B$1:$b$1001,int(0.29*1001)),"owner","non-owner")
<LARGE($B$1:$b$1001,int(0.29*1001)),"owner","non-owner") down.

=IF(B1 < LARGE($B$1:$B$1001,INT(0.29*1001)),"Owner","Non-Owner")

That will give you 290 random Non-Owners and 711 Owners. You can't get exactly 29% and 71% with a population of 1001.

You can change the 0.29 and the 1001 to reference cells instead of being hard wired if those values will likely change.</LARGE($B$1:$b$1001,int(0.29*1001)),"owner","non-owner")></LARGE($B$1:$b$1001,int(0.29*1001)),"owner","non-owner")
</LARGE($B$1:$b$1001,int(0.29*1001)),"owner","non-owner")"
 
Last edited:
Upvote 0
Thank you, it worked. What if i had more categories like owner 78%, renter 12%, Appropriation 3%, free housing 6%, and other 1%? <large($b$1:$b$1001,int(0.29*1001)),"owner","non-owner")"

</large($b$1:$b$1001,int(0.29*1001)),"owner","non-owner")"
 
Upvote 0
Put Owner, Renter, etc. in E1:E5
Put percentages in F1:F5 (i.e., .78, .12, ...)
Put =1-SUM(F$1:F1) in G1 and copy down to G5

Change C1 to =INDEX($E$1:$E$5,MATCH(TRUE,B1<=LARGE($B$1:$B$1001,1+INT($G$1:$G$5*1001)),0))
And Enter with Ctrl-Shift-Enter (not just Enter)

Copy C1 down to C1001

If you want to see actual percentages put =COUNTIF(C:C,E1)/1001 in D1 and drag down to D5
 
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,771
Members
452,353
Latest member
strainu

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