+ Reply to Thread
Results 1 to 7 of 7

Unique random numbers between two numbers

  1. #1
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Unique random numbers between two numbers

    Hello everybody
    I have this udf function that generates unique random numbers between two numbers
    Please Login or Register  to view this content.
    I need to get the results of this udf in range of cells say ("A1:A10")
    For example : I want to generate random numbers between 1 and 30 .. The number of the results should be 7 numbers
    So if I used the udf function
    Please Login or Register  to view this content.
    I got results in one cell.. I need to get the results in 7 cells
    < ----- Please click the little star * next to add reputation if my post helps you
    Visit Forum : From Here

  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: Unique random numbers between two numbers

    No need to reinvent the wheel, go here: http://www.cpearson.com/excel/randomnumbers.aspx

    The function you want is UniqueRandomLongs found about halfway down the page. It appears to have a setup identical to yours, so when you enter that function in a cell as an ARRAY, you will get unique values within that array of cells.
    _________________
    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!)

  3. #3
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Re: Unique random numbers between two numbers

    Thanks for reply Mr. JBeaucaire

    Is there a way to get the results fron this UDF function in range or it will be difficult and so I will have to search for any other solution?

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

    Re: Unique random numbers between two numbers

    Your question leads to me believe you haven't really looked at the suggested site. The UDF is designed to provide an ARRAY of results. So if you enter that formula in 10 cells at once using CTRL-SHIFT-ENTER, then that range of cells will be treated like an array and you will get the 10 answers. All the info needed is on that page.

  5. #5
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Re: Unique random numbers between two numbers

    Mr. JBeaucaire
    I have navigated the site you provided me and I used the UDF function which was in that page .
    It works very well ..
    In fact I don't need to solve the problem of getting unique random numbers .. I need to learn how to extract the results of array to be in ranges .. This is my point !
    Generally thanks for your help sir

  6. #6
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Re: Unique random numbers between two numbers

    Is it easy to do that task ?

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

    Re: Unique random numbers between two numbers

    I suppose I do not understand your question at this point.

+ 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. Random unique numbers
    By Peidus in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 11-23-2014, 01:34 PM
  2. [SOLVED] Unique random numbers
    By ducecoop in forum Excel General
    Replies: 3
    Last Post: 05-09-2012, 04:41 PM
  3. Unique random numbers
    By Bartlett in forum Excel General
    Replies: 2
    Last Post: 01-28-2012, 03:42 PM
  4. random unique numbers
    By Juli in forum Excel General
    Replies: 2
    Last Post: 05-05-2011, 05:48 PM
  5. Excel 2007 : unique random numbers
    By mani01 in forum Excel General
    Replies: 6
    Last Post: 03-24-2010, 05:50 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