+ Reply to Thread
Results 1 to 19 of 19

Random number to a specific total within a Range

  1. #1
    Registered User
    Join Date
    08-13-2009
    Location
    London,England
    MS-Off Ver
    Excel 2016
    Posts
    30

    Random number to a specific total within a Range

    I want to create random numbers for a specific total within a range.

    I'm a newbie to Excel. So if anyone can create and attach the excel file it will be more helpful.


    The upper limit,lower limit, No of random numbers & Total has to be entered manually and the excel sheet has to provide 31 random numbers.


    For example:
    I want to create random numbers for 40,000 within a range of 250 to 2,000

    Lower limit = 250
    Upper limit =2,000
    Random numbers Total will be 40,000
    No. of random numbers =31
    Duplicate Randoms: Allowed

    1864
    1800
    338
    780
    1304
    1600
    1281
    1239
    1700
    878
    1139
    1390
    1750
    540
    1839
    1460
    750
    828
    1925
    1724
    1822
    1353
    1769
    1950
    1952
    1603
    1423
    1999
    ---------------
    Total =40,000
    ---------------

    Thanks a lot.
    Last edited by lavan_joy; 08-13-2009 at 06:57 AM. Reason: updated

  2. #2
    Forum Expert
    Join Date
    08-27-2008
    Location
    England
    MS-Off Ver
    2010
    Posts
    2,561

    Re: Random number to a specific total within a Range

    Without trying to sound like a pedant - you dan not define random numbers to come to a given total - numbers which come to a pre-specified total are not random.

    Perhaps you could expand and we could look at which stage we need to replace "random" with "calculated"

    CC

  3. #3
    Registered User
    Join Date
    08-13-2009
    Location
    London,England
    MS-Off Ver
    Excel 2016
    Posts
    30

    Re: Random number to a specific total within a Range

    Thanks for the reply. I updated my post. Please check that.

  4. #4
    Forum Expert
    Join Date
    08-27-2008
    Location
    England
    MS-Off Ver
    2010
    Posts
    2,561

    Re: Random number to a specific total within a Range

    Well... whether the total is 40,000 or 50,000, my point remains.

  5. #5
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,602

    Re: Random number to a specific total within a Range

    Like this:

    Book1.xls

    Right now totaln number are 10.
    Write whatever you like only don't forget to extend formula down in random number column

  6. #6
    Registered User
    Join Date
    08-13-2009
    Location
    London,England
    MS-Off Ver
    Excel 2016
    Posts
    30

    Re: Random number to a specific total within a Range

    40,000 or 50,000. or any Number. I want to change the total manually everytime.

  7. #7
    Registered User
    Join Date
    08-13-2009
    Location
    London,England
    MS-Off Ver
    Excel 2016
    Posts
    30

    Re: Random number to a specific total within a Range

    Quote Originally Posted by Cheeky Charlie View Post
    Well... whether the total is 40,000 or 50,000, my point remains.
    40,000 or 50,000 or any particular number. I want to enter the total manually and need random numbers.


    Quote Originally Posted by zbor View Post
    Like this:

    Attachment 50680

    Right now totaln number are 10.
    Write whatever you like only don't forget to extend formula down in random number column
    Yes. I need like this. I need one more addition. The total of random numbers should be equal to the manually entered total. If I enter 40,000, then then the total of random numbers will be 40,000.

  8. #8
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,602

    Re: Random number to a specific total within a Range

    Yes, it is. Only extend formula down.

  9. #9
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Random number to a specific total within a Range

    i see cc's point. if you want random numbers to = a given total like that
    say you rand between 1-10 and you want the total 10 from 6 random numbers
    its possible that any generated 6 numbers will <>10 or come to that any 10 numbers wont = 10 say 5,7,4,9,8,8,4,4,7,9
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  10. #10
    Registered User
    Join Date
    06-01-2009
    Location
    India
    MS-Off Ver
    Excel 2003, Excel 2007
    Posts
    66

    Re: Random number to a specific total within a Range

    But the point still remains that the total should equal to a given specific number!! and thats not the case in the given solution
    Mohit Khurana, CFA

    Excel Matic - A blog on MS Excel

    List of Essential Excel Shortcuts

    e-Book on Excel Math Functions

    Please add to our reputation if you find our replies as helpful.

  11. #11
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Random number to a specific total within a Range

    so basically you want cells to keep recalculating until a given total is reached
    that might never happen or just take ages to do

  12. #12
    Registered User
    Join Date
    06-01-2009
    Location
    India
    MS-Off Ver
    Excel 2003, Excel 2007
    Posts
    66

    Re: Random number to a specific total within a Range

    Exactly, that is what my point is. It is not possible to do this. Any other way which can help solve this would probably would need to write macros

  13. #13
    Registered User
    Join Date
    08-13-2009
    Location
    London,England
    MS-Off Ver
    Excel 2016
    Posts
    30

    Re: Random number to a specific total within a Range

    Quote Originally Posted by martindwilson View Post
    so basically you want cells to keep recalculating until a given total is reached
    that might never happen or just take ages to do
    I agree with you. If anyone find a way, please let us know.


    Can anyone make like this? The total of random number should be any closer number to the input total.
    Input total =40,000

    The random number's total which is closer to 40,000 is enough. For Example 39,250 or 40,850

  14. #14
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Random number to a specific total within a Range

    well i thought ah! solver but that is limited to 200 changes so i did it with 200 rand numbers and the nearest was 42000ish but its a bit buggy given unexpected results im off to try it on another version of excel
    hm when its that big it wont rcognise binary restraints!!!!!!!!
    Last edited by martindwilson; 08-13-2009 at 09:30 AM.

  15. #15
    Forum Expert
    Join Date
    08-27-2008
    Location
    England
    MS-Off Ver
    2010
    Posts
    2,561

    Re: Random number to a specific total within a Range

    Quote Originally Posted by Excel Matic View Post
    Exactly, that is what my point is. It is not possible to do this. Any other way which can help solve this would probably would need to write macros
    I believe that was my point...

    We could easily make a set of random numbers which come to a predefined total (each random number * desired total / (sum of random numbers))

    But the beginning and end point would not be fixed...

    We could also make a set of random numbers with fixed beginning and end points (random number * (max + min) ) - min
    but this would not have a predefined total...

    You have to choose, OP, to give up specifying either:
    your beginning and end points,
    the total sum, or:
    the total number of random numbers

    CC

  16. #16
    Registered User
    Join Date
    08-13-2009
    Location
    London,England
    MS-Off Ver
    Excel 2016
    Posts
    30

    Re: Random number to a specific total within a Range

    Edited:
    I don't know what to do!!!

    If anyone find a way (if possible) let us know about that. Thanks for all of your help guys.
    Last edited by lavan_joy; 08-13-2009 at 09:04 AM.

  17. #17
    Forum Expert
    Join Date
    08-27-2008
    Location
    England
    MS-Off Ver
    2010
    Posts
    2,561

    Re: Random number to a specific total within a Range

    Here,

    Beginning and end points fixed, total fixed(ish) total number of random numbers varies. As per request before editing post!

    HTH
    Attached Files Attached Files

  18. #18
    Registered User
    Join Date
    08-13-2009
    Location
    London,England
    MS-Off Ver
    Excel 2016
    Posts
    30

    Re: Random number to a specific total within a Range

    Thanks Cheeky Charlie! Very helpful one.

  19. #19
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Random number to a specific total within a Range

    now that was simple cc!!! so obvious, wood for trees me

+ 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