+ Reply to Thread
Results 1 to 7 of 7

Generate column of 1's and 0's randomly

  1. #1
    Ian Engelbrecht
    Guest

    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!

  2. #2
    Ardus Petus
    Guest

    Re: 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(A1>0.2;0;1)

    HTH
    --
    AP

    "Ian Engelbrecht" <[email protected]> a écrit dans le message de
    news:[email protected]...
    > 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!




  3. #3
    Ardus Petus
    Guest

    Re: Generate column of 1's and 0's randomly

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

    HTH
    --
    AP

    "Ian Engelbrecht" <[email protected]> a écrit dans le message de
    news:[email protected]...
    > 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!




  4. #4
    Guest

    Re: Generate column of 1's and 0's randomly

    Good call. I like it!

    Andy.

    "Ardus Petus" <[email protected]> wrote in message
    news:[email protected]...
    > One way to do it would be to add a staging column containing formula
    > =RAND()
    > On next column, enter formula =IF(A1>0.2;0;1)
    >
    > HTH
    > --
    > AP
    >
    > "Ian Engelbrecht" <[email protected]> a écrit dans le message de
    > news:[email protected]...
    >> 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!

    >
    >




  5. #5
    Niek Otten
    Guest

    Re: 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" <[email protected]> wrote in message news:[email protected]...
    > 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!




  6. #6
    Ian Engelbrecht
    Guest

    Re: 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" <[email protected]> a écrit dans le message de
    > news:[email protected]...
    > > 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!

    >
    >
    >


  7. #7
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675
    ....or even....

    =(RAND()<0.2)+0

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1