Random Number Generator with flexible probability

Jayem1

New Member
Joined
Dec 18, 2013
Messages
7
Hello,


I am not sure of the proper terminology of what I am looking for but here is a description...


I am looking to create a column of 1,000 results with each cell showing one of two numbers (ideally for me would be a "1" and a "-1"). I would like to be able to change what percentage of the time the "1" shows up, ie. in each cell there could be a 60% chance that the "1" would show up meaning there would be a 40% chance of the "-1" showing up.




Currently I am using the formula: =RANDBETWEEN(0, 1) to create what I hope is a 50/50 chance of either a "0" or a "1" showing up in each cell. I could not get the "-1" to work right but can work around that if it is not possible. The "0" and "1" will work fine.




This is for a trading scenario similar to a heads or tails (win /loss) simulation but with the ability to program the "win" percentage rate.


Is this possible? If so how do I do it?


Thank you,


Jason


PS. I did look at the other threads but could not figure out what would work in my situation.
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
FYI: If I don't add the "+0" at the end of the formula it still generates the number but in a format that I cannot add the results with. If I make a column of numbers the SUM of that column always comes out zero. But when I add "+0" to the formula I am able to add up the results.
 
Upvote 0
The formula in post#2 returns text without the +0; the one in post 4 returns a number.
 
Upvote 0
Thanks, I see what I did. I left the quotation marks in.

I put: =IF(RAND()<0.6,"1","-1")

Instead of:
=IF(RAND()<0.6, 1,-1)

 
Upvote 0

Forum statistics

Threads
1,215,721
Messages
6,126,461
Members
449,315
Latest member
misterzim

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