ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Generate column of 1's and 0's randomly (https://www.excelbanter.com/excel-discussion-misc-queries/80817-generate-column-1s-0s-randomly.html)

Ian Engelbrecht

Generate column of 1's and 0's randomly
 
Hi all, I would like to add a column to my spreadsheet with randomly
generated 1's and 0's. I would like to be able to set the probability with
which these are generated, eg each time the number is generated there is a
20% probability that it will be 1, and 80% that it will be zero. Would
appreciate it STACKS if someone could help me out!

Ardus Petus

Generate column of 1's and 0's randomly
 
One way to do it would be to add a staging column containing formula =RAND()
On next column, enter formula =IF(A10.2;0;1)

HTH
--
AP

"Ian Engelbrecht" a écrit dans le message de
...
Hi all, I would like to add a column to my spreadsheet with randomly
generated 1's and 0's. I would like to be able to set the probability

with
which these are generated, eg each time the number is generated there is a
20% probability that it will be 1, and 80% that it will be zero. Would
appreciate it STACKS if someone could help me out!




Ardus Petus

Generate column of 1's and 0's randomly
 
Even simpler (no staging column)
=IF(RAND()0.2,0,1)

HTH
--
AP

"Ian Engelbrecht" a écrit dans le message de
...
Hi all, I would like to add a column to my spreadsheet with randomly
generated 1's and 0's. I would like to be able to set the probability

with
which these are generated, eg each time the number is generated there is a
20% probability that it will be 1, and 80% that it will be zero. Would
appreciate it STACKS if someone could help me out!





Generate column of 1's and 0's randomly
 
Good call. I like it!

Andy.

"Ardus Petus" wrote in message
...
One way to do it would be to add a staging column containing formula
=RAND()
On next column, enter formula =IF(A10.2;0;1)

HTH
--
AP

"Ian Engelbrecht" a écrit dans le message de
...
Hi all, I would like to add a column to my spreadsheet with randomly
generated 1's and 0's. I would like to be able to set the probability

with
which these are generated, eg each time the number is generated there is
a
20% probability that it will be 1, and 80% that it will be zero. Would
appreciate it STACKS if someone could help me out!






Niek Otten

Generate column of 1's and 0's randomly
 
In column A:
=RANDBETWEEN(1,100)

Fill down as far as needed

In column B:
=IF(RIGHT(A1,1)"8",0,1) (of course "8" can be something else)

Fill down

--
Kind regards,

Niek Otten

"Ian Engelbrecht" wrote in message ...
Hi all, I would like to add a column to my spreadsheet with randomly
generated 1's and 0's. I would like to be able to set the probability with
which these are generated, eg each time the number is generated there is a
20% probability that it will be 1, and 80% that it will be zero. Would
appreciate it STACKS if someone could help me out!




Ian Engelbrecht

Generate column of 1's and 0's randomly
 
Thanks a lot for the help folks, much appreciated!

"Ardus Petus" wrote:

Even simpler (no staging column)
=IF(RAND()0.2,0,1)

HTH
--
AP

"Ian Engelbrecht" a écrit dans le message de
...
Hi all, I would like to add a column to my spreadsheet with randomly
generated 1's and 0's. I would like to be able to set the probability

with
which these are generated, eg each time the number is generated there is a
20% probability that it will be 1, and 80% that it will be zero. Would
appreciate it STACKS if someone could help me out!





daddylonglegs

Generate column of 1's and 0's randomly
 

....or even....

=(RAND()<0.2)+0


--
daddylonglegs
------------------------------------------------------------------------
daddylonglegs's Profile: http://www.excelforum.com/member.php...o&userid=30486
View this thread: http://www.excelforum.com/showthread...hreadid=528597



All times are GMT +1. The time now is 02:40 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com