+ Reply to Thread
Results 1 to 2 of 2

generate random numbers

  1. #1
    Registered User
    Join Date
    02-08-2009
    Location
    England
    MS-Off Ver
    Excel 2003
    Posts
    2

    generate random numbers

    I want to be able to generate random numbers as weights for the amount of companies selected,eg if 5 companies where selected then generate 5 weights.
    How do you think I can go about it ,as I have thought of creating different types of sheets and just have a command button for different scenario and just trusting the user to select the appropriate one.?
    Last edited by VBA Noob; 02-09-2009 at 09:17 AM.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: generate random numbers

    The RANDBETWEEN() function let's you determine the range of values.

    To determine the number displayed you could use a trick that compares row numbers to a cell value that you control.

    For instance, in cell C1 you enter the value of 5.

    In A1 you enter this formula and copy it down 20 rows or so:

    =IF(ROW()<=$C$1,RANDBETWEEN(1,100),"")

    Now, only the number of random numbers matching the value in C1 will appear in column A.
    Last edited by JBeaucaire; 02-08-2009 at 09:56 PM. Reason: Made C1 and absolute reference
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

+ 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