+ Reply to Thread
Results 1 to 8 of 8

Population of 1's and 0's

  1. #1
    Registered User
    Join Date
    09-29-2011
    Location
    Twin Cities, MN
    MS-Off Ver
    Excel 2003
    Posts
    2

    Population of 1's and 0's

    Hey everyone, I have a problem I am working on in Excel ( I can do it in SAS, but I need to do it exclusively with Excel). I work for a company that is interested in response rates of sales campaigns and I have been put in charge of constructing confidence intervals for the response rate. What I am given is an estimate for the response rate and a population size. What I need is a way to generate a field of 1's and 0's with a size the same as the sample size, and the number of 1's is equal to the estimate of responders. Here's an example:


    Say I want to test a campaign on 50,000 people and expect a response rate of 4%. Then I want to generate a field that has 50,000 numbers in it, but has only 4% of 50,000=2000 1's and the other 48,000 are 0's.

    Is this possible in Excel and, if so, how do I do it?

  2. #2
    Valued Forum Contributor tlafferty's Avatar
    Join Date
    04-08-2011
    Location
    United States, Tacoma, WA
    MS-Off Ver
    Excel 2010, Excel 2013 Customer Preview
    Posts
    1,112

    Re: Population of 1's and 0's

    Select cells A1:A2000. Type the number 1, then press CTRL + Enter. Select cells A2001:A50000. Type the number 0, then press CTRL + Enter. In cell B1 enter the formula:
    Please Login or Register  to view this content.
    Autofill this formula through B50000. Click any single cell and the B column, then click the sort button. Since the numbers are random, it will randomly distribute the 1s and 0s.
    If your question has been satisfactorily addressed, please consider marking it solved. Click the Thread Tools dropdown and select Mark thread as solved.
    Also, you might want to add to the user's reputation by clicking the star icon in the lower left corner of the post with the answer- it's why we do what we do...

    Thomas Lafferty
    Analyst/Programmer

  3. #3
    Registered User
    Join Date
    09-29-2011
    Location
    Twin Cities, MN
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: Population of 1's and 0's

    That definitely works for the specific example. What I am looking for, and I apologize for not being clear about this before, is a way to input a specific population size into a cell, and then a response rate into another cell, and then from that populate the field of 1's and 0's.

  4. #4
    Valued Forum Contributor tlafferty's Avatar
    Join Date
    04-08-2011
    Location
    United States, Tacoma, WA
    MS-Off Ver
    Excel 2010, Excel 2013 Customer Preview
    Posts
    1,112

    Re: Population of 1's and 0's

    This code is in the attached workbook:
    Please Login or Register  to view this content.
    Attached Files Attached Files

  5. #5
    Valued Forum Contributor
    Join Date
    02-12-2011
    Location
    The Netherlands
    MS-Off Ver
    365
    Posts
    818

    Re: Population of 1's and 0's

    Much faster over 50.000 rows.
    Speed ​​depends on the rate.

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Kind regards, Harry.

  6. #6
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Population of 1's and 0's

    hi, zuehlkescott5, please check attachment, input values in A2 and B2 and run code "test".
    Attached Files Attached Files
    Last edited by watersev; 10-03-2011 at 04:55 PM.

  7. #7
    Valued Forum Contributor tlafferty's Avatar
    Join Date
    04-08-2011
    Location
    United States, Tacoma, WA
    MS-Off Ver
    Excel 2010, Excel 2013 Customer Preview
    Posts
    1,112

    Re: Population of 1's and 0's

    Hi Watersev and HSV - I may have misunderstood goal of the confidence intervals. Isn't that something for Monte Carlo style (randomized) simulation? If so, the 1s and 0s should appear in random order.

  8. #8
    Valued Forum Contributor
    Join Date
    02-12-2011
    Location
    The Netherlands
    MS-Off Ver
    365
    Posts
    818

    Re: Population of 1's and 0's

    Hello Thomas,

    If so, then .....
    Please Login or Register  to view this content.
    Attached Files Attached Files

+ 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