+ Reply to Thread
Results 1 to 4 of 4

Need for a random formula that generates a pre-determined distribution

  1. #1
    Registered User
    Join Date
    09-14-2016
    Location
    Minneapolis, MN
    MS-Off Ver
    Professional Plus 2010 Ver 14.0.7172.5000 (32-bit)
    Posts
    21

    Need for a random formula that generates a pre-determined distribution

    Hi everyone,

    I was using the RandBetween formula to generate a random Ratings number between 1 and 3 (in Column B) for 10 employee ID numbers (1 to 10 in Column A). It was easy to use.

    I have one question:
    I wanted the Ratings to have a pre-determined forced distribution where Rating 1 = 10%; Rating 2 = 80% and Rating 3 = 10%. How do you generate a random number where the ratings distribution always equals this forced distribution? In this example using 10 employees, 8 employees will have a Ratings of 2, 1 employee will have a Rating of 1 and 1 employee will have a Rating of 1. Currently, the randomly generated Copy/Paste results of the RandBetween formula generated 2 employees with a Rating of 2, 5 employees with a Ratings of 1, and 3 employees with a Rating of 3.

    I have one comment:
    As you can see the RandBetween formula generates a random number every time I saved the file and re-open it. The count of of the Ratings in the Summary changes each time I re-open the file. I know this an Excel rule, and I can easily copy/paste the results at the bottom (below the black line) to save the distribution that I want.

    I would greatly appreciate your help on this formula.

    Thank you,
    Jerry
    Attached Files Attached Files

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Need for a random formula that generates a pre-determined distribution

    To guarantee a predetermined distribution, you can't generate random numbers. It's a mathematical contradiction. You have to predetermine the numbers that will give you the desired distribution, and then randomly assign them to the employees.

    I have set this up in your sample file. Also, I would leave formulas in C37:D40, since those formulas will still be valid.

    Your method of freezing the data by copy/paste values works. For a more robust solution we could use VBA to put the values directly in.
    Attached Files Attached Files
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Forum Expert
    Join Date
    02-10-2019
    Location
    Georgia, USA
    MS-Off Ver
    Office 365
    Posts
    2,831

    Re: Need for a random formula that generates a pre-determined distribution

    ** - I did not see Jeff's post before posting mine. **


    Well, here's an option - using a "helper" column:
    In C2, enter:
    =RAND()
    and copy down the 10 rows
    If you're doing it for exactly 10 rows, then in B2, enter:

    =IF(C2=MIN($C$2:$C$11),1,IF(C2=MAX($C$2:$C$11),3,2))

    If you want it to be a little more flexible, you can use this, and change the ranges as you add/remove rows:

    =IF(C2<=SMALL($C$2:$C$11,0.1*COUNT($A$2:$A$11)),1,IF(C2>=LARGE($C$2:$C$11,0.1*COUNT($A$2:$A$11)),3,2))

    and copy down.

    If you don't want the formulas to generate a number all the time, and only when YOU want them to, you can always go to FORMULAS>"Calculation Options">"Manual"
    Last edited by Gregb11; 12-27-2021 at 11:33 PM. Reason: clarification

  4. #4
    Registered User
    Join Date
    09-14-2016
    Location
    Minneapolis, MN
    MS-Off Ver
    Professional Plus 2010 Ver 14.0.7172.5000 (32-bit)
    Posts
    21

    Re: Need for a random formula that generates a pre-determined distribution

    Thank you so much 6StringJazzer and Gregb11 for responding to my query. It works!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Creating a workbook that generates random information
    By ddykstra84 in forum Excel General
    Replies: 1
    Last Post: 06-09-2021, 02:37 PM
  2. macro that generates random selection set from table
    By foxtrotter in forum Tips and Tutorials
    Replies: 0
    Last Post: 10-30-2019, 05:01 PM
  3. Replies: 2
    Last Post: 07-29-2017, 02:17 AM
  4. Replies: 2
    Last Post: 07-29-2017, 02:17 AM
  5. [SOLVED] Construct a formula on a pre-determined cell for a pre-determined duration of cells
    By Shaun Gemiver in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 01-03-2013, 11:14 AM
  6. how are random numbers determined
    By Mike Middleton in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 09-06-2005, 07:05 AM
  7. how are random numbers determined
    By hectorvector in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-05-2005, 10:05 PM

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