Having an outcome occur randomly a given percentage of the time

jrsimon25

New Member
Joined
Jul 23, 2020
Messages
1
Office Version
  1. 2016
Platform
  1. MacOS
Hello, I'm new to this so I hope I'm doing this correctly.

Is there a way to write a formula so that one outcome occurs randomly a given percentage of the time and another outcome occurs the rest of the time?

For instance, I want the number 1 to randomly be entered 40% and the number 2 to be entered the rest of the time (or 60% of the time).

If there is a way to do this, how?

Thank you in advance
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
Maybe:
Book1.xlsm
AB
110.04968
Sheet3
Cell Formulas
RangeFormula
A1A1=IF(B1<=0.4,1,2)
B1B1=RAND()

To run trials press the F9 key to cause recalculation and a new value in B1. If you run enough trials, 1 should be returned in A1 in about 40% of the trials.
 
Upvote 0
Welcome to the MrExcel board!

Does this do what you want? Change the 40 for a different percentage.

=MATCH(RANDBETWEEN(0,99),{0,40})
 
Upvote 0
If I understand you correctly, you like to set a certain percentage x%, and you need one event to occur exactly x% in y simulations, the other non-event exactly (1-x)%?
So if x is 40, and y=100, you want to get 100 random results but 40 events vs 60 non-events exactly.
I needed this to generate 45% male names and 55% female names (or a bit more complex, 30% American, 40% European and 30% Asian countries), for example.
If my assumption is correct, then I can provide a link if the moderators agree.
 
Upvote 0

Forum statistics

Threads
1,214,585
Messages
6,120,388
Members
448,957
Latest member
Hat4Life

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