+ Reply to Thread
Results 1 to 8 of 8

PLS HELP: random unique-non repeated numbers.

  1. #1
    Registered User
    Join Date
    01-06-2012
    Location
    Cebu Philippines
    MS-Off Ver
    Excel 2007
    Posts
    3

    Question PLS HELP: random unique-non repeated numbers.

    Hi everyone!

    I have this project for a client who wants me to produce 200,000 pcs of scratch cards (for mobile phones) and the last time I tried generating 6,000 "random unique-non repeated numbers" using randbetween there were about 150 duplicates that came up. I would like to know how if there is really a way in excel to do this..

    any help will be appreciated..

    by the way, below is a sample:

    SERIAL PIN

    20319422 ACA95368


    thank you!!

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

    Re: PLS HELP: random unique-non repeated numbers.

    please post in the correct sub forum
    "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

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

    Re: PLS HELP: random unique-non repeated numbers.

    Try this, put this formula in A1:

    =LEFT(INT(RAND()*10000000000), 8) + 0


    Put this B1:

    =CHAR(RANDBETWEEN(1,26)+64) & CHAR(RANDBETWEEN(1,26)+64) & CHAR(RANDBETWEEN(1,26)+64) & TEXT(RANDBETWEEN(1,99999), "00000")



    Copy both cells down 6000 rows. Pretty unlikely you'll get any dupes.


    I've asked the moderators to move this thread to the appropriate forum.
    Last edited by JBeaucaire; 01-07-2012 at 01:03 PM. Reason: Changed ALPHA portion to something shorter, NUMERIC to something shorter
    _________________
    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!)

  4. #4
    Forum Expert dangelor's Avatar
    Join Date
    09-06-2011
    Location
    Indiana, USA
    MS-Off Ver
    365 Pro Plus
    Posts
    2,274

    Re: PLS HELP: random unique-non repeated numbers.

    It's a bit slow generating 200,000 numbers...
    Please Login or Register  to view this content.

  5. #5
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: PLS HELP: random unique-non repeated numbers.

    Why not just make a list of 200000 sequential numbers and then put them in random order?
    Entia non sunt multiplicanda sine necessitate

  6. #6
    Registered User
    Join Date
    01-06-2012
    Location
    Cebu Philippines
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: PLS HELP: random unique-non repeated numbers.

    Quote Originally Posted by JBeaucaire View Post
    Try this, put this formula in A1:

    =LEFT(INT(RAND()*10000000000), 8) + 0


    Put this B1:

    =CHAR(RANDBETWEEN(1,26)+64) & CHAR(RANDBETWEEN(1,26)+64) & CHAR(RANDBETWEEN(1,26)+64) & TEXT(RANDBETWEEN(1,99999), "00000")



    Copy both cells down 6000 rows. Pretty unlikely you'll get any dupes.


    I've asked the moderators to move this thread to the appropriate forum.
    My bad I posted on the wrong thread.

    THANK YOU!! by the way, will I get any duplicates if I copy it down to 200,000 cells? or it will limit me to 6000 (w/o duplicates)?

  7. #7
    Registered User
    Join Date
    01-06-2012
    Location
    Cebu Philippines
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: PLS HELP: random unique-non repeated numbers.

    Quote Originally Posted by dangelor View Post
    It's a bit slow generating 200,000 numbers...
    Please Login or Register  to view this content.
    thank you dangelor! I manage to come up with 200,000 numbers using your code but it was reallyyyy slow as you said. On your code it says 6000 so I would like to know if I stretch it to 200,000 will I be likely to get duplicates? Also, how can I make this alpha-numeric?

  8. #8
    Forum Expert dangelor's Avatar
    Join Date
    09-06-2011
    Location
    Indiana, USA
    MS-Off Ver
    365 Pro Plus
    Posts
    2,274

    Re: PLS HELP: random unique-non repeated numbers.

    You can easily check for duplicates by sorting the output A-Z, adding a helper column with a formula =A2-A1 and copy down, then copy the helper column and paste as values, and finally sort the helper column A-Z. if there are any duplicates, you will see a zero value at the top of the list.

    As for alpha-numeric, not sure... would the alpha characters always be in the same position in the string?

+ 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