+ Reply to Thread
Results 1 to 10 of 10

Finding any matches among randomly generated numbers.

  1. #1
    Registered User
    Join Date
    06-25-2012
    Location
    myrtle
    MS-Off Ver
    Excel 2011
    Posts
    4

    Finding any matches among randomly generated numbers.

    Hello,

    I used the =RANDBETWEEN function to generate 100 randomly generated numbers down a column. I am having issues when trying to use the =COUNTIF function to search for duplicates. Every time I insert the =COUNTIF function, new numbers are generated.

    Any ideas point me in the right direction would be greatly appreciated.

    thanks

  2. #2
    Valued Forum Contributor
    Join Date
    03-16-2012
    Location
    Aarhus, Denmark
    MS-Off Ver
    Excel 2007
    Posts
    992

    Re: Finding any matches among randomly generated numbers.

    Everytime your workbook recalculates the values returned by the =RANDBETWEEN() formula change. What are you using the values for?
    Sincerely
    S?ren Larsen

    "Give a man a fish, and you'll feed him for a day. Give a man a fishing rod, and he'll steal your yacht!"

  3. #3
    Registered User
    Join Date
    06-25-2012
    Location
    myrtle
    MS-Off Ver
    Excel 2011
    Posts
    4

    Re: Finding any matches among randomly generated numbers.

    Is there a way to run both functions simultaneously? so when RANDBETWEEN generates the numbers, COUNTIF can check for duplicates?

  4. #4
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: Finding any matches among randomly generated numbers.

    You can use conditional formatting on the column to highlight the duplicates Or use vba to do the Randbetween and countif and print the results to the sheet
    Please consider:

    Thanking those who helped you. Click the star icon in the lower left part of the contributor's post and add Reputation.
    Cleaning up when you're done. Mark your thread [SOLVED] if you received your answer.

  5. #5
    Valued Forum Contributor
    Join Date
    03-16-2012
    Location
    Aarhus, Denmark
    MS-Off Ver
    Excel 2007
    Posts
    992

    Re: Finding any matches among randomly generated numbers.

    Not as such. But what are you trying to achieve? There might be an alternative such as:

    1) Increasing the limits in the =RANDBETWEEN() can eliminate duplicates
    2) Using =RAND() with =RANK() can eliminate duplicates

  6. #6
    Registered User
    Join Date
    06-25-2012
    Location
    myrtle
    MS-Off Ver
    Excel 2011
    Posts
    4

    Re: Finding any matches among randomly generated numbers.

    Thank you for the responses.

    I am not trying to eliminate the duplicates. Instead, I am trying to measure how many duplicates there are. Instead of doing it manually, I thought COUNTIF would be the most appropriate. Would I be incorrect in my thinking? thanks

  7. #7
    Forum Expert
    Join Date
    06-26-2010
    Location
    Austin, TX
    MS-Off Ver
    Excel 2010
    Posts
    1,673

    Re: Finding any matches among randomly generated numbers.

    Try disabling the automatic calculation. Go to the 'File' icon (the one you click on to open, save, print, etc. It looks like the Windows logo), and at the bottom of that window choose 'Excel Options'.
    Choose 'Formulas' and then change the 'Workbook Calculation' to Manual (and you will likely want to uncheck the 'Recalculate before saving' option.
    This will prevent any calculations (including RANDBETWEEN) from occurring. To force a new calculation, you need to hit the F9 key.

    Pauley

  8. #8
    Registered User
    Join Date
    06-25-2012
    Location
    myrtle
    MS-Off Ver
    Excel 2011
    Posts
    4

    Re: Finding any matches among randomly generated numbers.

    thank you, Pauley and Abousetta.

    I am on Excell 2011 for the Mac. When I tried 'Conditional formatting', it would not let me input a formula. Instead, I had a drop down option of highlighting 'duplicates'. I chose that.
    I'm still trying to see if I can directly use the COUNTIF formula.


    thanks again

  9. #9
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: Finding any matches among randomly generated numbers.

    I'm not exactly sure what you are trying to accomplish but here goes:

    Please Login or Register  to view this content.

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

    Re: Finding any matches among randomly generated numbers.

    i dont get it either, just put =--countif($a$1:$a$100,row(a1))>1 drag down 100 rows then all those marked 1 wild be duplicates
    use sum on that to find out how many different numbers are duplicated
    or =countif($a$1:$a$100,row(a1)) and you could see how many times each is duplicated
    "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

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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