+ Reply to Thread
Results 1 to 7 of 7

Random Number Generator Help

  1. #1
    Registered User
    Join Date
    03-07-2013
    Location
    new jersey
    MS-Off Ver
    Excel 2003
    Posts
    8

    Random Number Generator Help

    Hi Guys,

    What id like to do is in cell A1 generate a digit between 1 and 10. In cell A2 I would like to do the same. I would also like A2 to compare its digit to A1 and if its the same number, re-generate another. How can I do this? Thanks in advance.

  2. #2
    Forum Expert Ace_XL's Avatar
    Join Date
    06-04-2012
    Location
    UAE
    MS-Off Ver
    2016
    Posts
    6,074

    Re: Random Number Generator Help

    In A1 and A2
    =RANDBETWEEN(1,10)

    In A3
    =IF(A2=A1,RANDBETWEEN(1,10),"")
    Life's a spreadsheet, Excel!
    Say thanks, Click *

  3. #3
    Registered User
    Join Date
    03-07-2013
    Location
    new jersey
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Random Number Generator Help

    thank you for your response. I should have been more specific though. if A2 checks to see if the number it generated was the same as A1, i would like it to re-generate a number WITHIN A2 again. by writing over its number with a new one. not by incorporating another cell(A3). is this possible??

  4. #4
    Valued Forum Contributor
    Join Date
    07-27-2012
    Location
    Dublin, Ireland
    MS-Off Ver
    Excel 2010
    Posts
    826

    Re: Random Number Generator Help

    Tkurtz, welcome to the forum.

    Have a look at post # 4 in this thread: http://www.mrexcel.com/forum/excel-q...ng-values.html - it appears that this will do what you're describing.

    Hope this helps.
    Brendan.


    __________________________________________________________________________________________________
    Things to consider:

    1) You can thank any poster by clicking the * at the left of a helpful post.
    2) You can help to keep the forum tidy by marking your thread as "Solved", if it has been answered to your satisfaction.
    3) Help us to help you, by uploading a sample workbook, showing the type of data you're dealing with, and clearly indicating what the results should be.

  5. #5
    Forum Contributor
    Join Date
    09-27-2012
    Location
    Florida
    MS-Off Ver
    Excel XP to 2013
    Posts
    342

    Re: Random Number Generator Help

    You can do it with the MRAND array function from the morefunc addin. Can't seem to find a link but If you search the net I'm sure you can find it

  6. #6
    Registered User
    Join Date
    03-07-2013
    Location
    new jersey
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Random Number Generator Help

    thanks everybody for actually responding.

    i have a similar yet different one now that i cannot figure out. in A1 I would like to again create a random digit 1-10 but this time in A2 i would like to create a random digit 4-20. There is an overlap so there is the possibility still of creating redundant numbers, which i don't want. Yet their array sizes are different. how would you go about doing that? excel just yells at me when i try different things. i figured it would be easier just to ask. Thanks guys.

  7. #7
    Forum Contributor
    Join Date
    09-27-2012
    Location
    Florida
    MS-Off Ver
    Excel XP to 2013
    Posts
    342

    Re: Random Number Generator Help

    You will still getting duplicate number between 4 and 10 in A1 and A2, if I read you correctly. The =randbetween() formula only works in one cell. Without a helper cell, VBA or the MRAND formula, I mentioned, you will not be able to be 100% sure you will not get duplicate number.
    Last edited by Tank997; 03-07-2013 at 10:21 PM.

+ 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