+ Reply to Thread
Results 1 to 4 of 4

3-5-3 Random, Unique Alphanumeric Code Generation

  1. #1
    Registered User
    Join Date
    07-13-2015
    Location
    Chicago, IL
    MS-Off Ver
    2013
    Posts
    14

    3-5-3 Random, Unique Alphanumeric Code Generation

    My end goal is to have an 11 digit code. We want to have a 5-digit random but unique code that will be attributed as a promo code. We then want to have 3-digit random but non-unique codes before and after the 5-digit code. We want to keep the order of number, letter, number, letter, etc.

    I figured the easiest was to do this would be to have three columns with the five digit code, so we know what that is, and then combine all three columns into a fourth column.

    I've added an example spreadsheet to help show the idea. I'm just trying to figure out what the easiest way to process this would be.

    Thanks!
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor quekbc's Avatar
    Join Date
    01-18-2010
    Location
    Sydney, Australia
    MS-Off Ver
    2010, 2013, 2016
    Posts
    1,149

    Re: 3-5-3 Random, Unique Alphanumeric Code Generation

    I'd use a series of RANDBETWEENs and convert them to alphanumeric equivalents. Then have a separate column to test whether the middle 5 codes are truly unique, if they are not, then do not use that code. Once you are happy with the codes generated, hard-code the RANDBETWEENs

    See attach for example.
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    07-13-2015
    Location
    Chicago, IL
    MS-Off Ver
    2013
    Posts
    14

    Re: 3-5-3 Random, Unique Alphanumeric Code Generation

    That makes sense, but my hesitance to use RANDBETWEENS is that they could eventually start making repeating codes if we start creating a large volume of them (we initially need about 6,500), so if I did that method how would I verify that the codes were unique, outside of manually checking or finding duplicates?

  4. #4
    Valued Forum Contributor quekbc's Avatar
    Join Date
    01-18-2010
    Location
    Sydney, Australia
    MS-Off Ver
    2010, 2013, 2016
    Posts
    1,149

    Re: 3-5-3 Random, Unique Alphanumeric Code Generation

    Hi mccodden, did you read my post in its entirety? Did you see the attached file I uploaded especially in column AD?
    Then have a separate column to test whether the middle 5 codes are truly unique, if they are not, then do not use that code.
    I've already addressed those issues.

    Furthermore, if you're only looking for 6500 codes, the chances of randbetween getting duplicates are low as the total number of different combinations are 5,189,853,515,625. If you do get duplicates, just generate 10,000 and delete those that have been identified as duplicates.

+ 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. Replies: 2
    Last Post: 11-06-2014, 05:07 PM
  2. How to generate unique random alphanumeric 32 character codes?
    By JussiR in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 02-21-2014, 06:30 AM
  3. Replies: 1
    Last Post: 01-22-2013, 07:02 AM
  4. Replies: 0
    Last Post: 04-20-2012, 06:55 AM
  5. Problem with random code generation
    By Oleg in forum Excel General
    Replies: 1
    Last Post: 04-04-2011, 06:24 AM
  6. Code for Unique random numbers
    By davidm in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 08-09-2007, 02:47 PM
  7. code not working properly - VBA beginner (random numbers generation, no repeats)
    By msburza in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-11-2006, 01:10 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