Closed Thread
Results 1 to 7 of 7

How do I generate 6 random characters (4 numerical, 2 alpha)?

  1. #1
    Registered User
    Join Date
    07-23-2010
    Location
    Denver, CO
    MS-Off Ver
    Excel 2003
    Posts
    3

    How do I generate 6 random characters (4 numerical, 2 alpha)?

    I need some assistance. I need to create a spreadsheet with 1 column and 4000 rows. In each cell I need 6 random characters (4 numerical and 2 alpha). Any suggestions on how I can do this in Excel 2003? Thanks!

  2. #2
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,885

    Re: How do I generate 6 random characters (4 numerical, 2 alpha)?

    Hi Dcdigiacomo, welcome to the forum.

    The following formula will generate random codes having 4-digits & 2 characters (always num-num-num-num-char-char). Hopefully that works for you.

    =TEXT(RANDBETWEEN(0,9999),"0000")&CHAR(RANDBETWEEN(65,90))&CHAR(RANDBETWEEN(65,90))

    Every time the worksheet calculates these codes will change, so if you want them to remain you will have to copy them (copy A1:A4000) then select A1 and use PasteSpecial -> Values to convert the formulas to static values.

  3. #3
    Registered User
    Join Date
    07-23-2010
    Location
    Denver, CO
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: How do I generate 6 random characters (4 numerical, 2 alpha)?

    Quote Originally Posted by Paul View Post
    =TEXT(RANDBETWEEN(0,9999),"0000")&CHAR(RANDBETWEEN(65,90))&CHAR(RANDBETWEEN(65,90))
    Perfect! One more question. How would I modify the formula so it generates lower case characters instead of upper case?
    Last edited by Paul; 07-23-2010 at 04:19 PM.

  4. #4
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,885

    Re: How do I generate 6 random characters (4 numerical, 2 alpha)?

    You would change the formula to:

    =TEXT(RANDBETWEEN(0,9999),"0000")&CHAR(RANDBETWEEN(97,122))&CHAR(RANDBETWEEN(97,122))

  5. #5
    Registered User
    Join Date
    07-23-2010
    Location
    Denver, CO
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: How do I generate 6 random characters (4 numerical, 2 alpha)?

    Awesome! Thanks for all your help and thanks from the previous user.
    Last edited by Paul; 07-23-2010 at 04:19 PM. Reason: Removed quotation

  6. #6
    Registered User
    Join Date
    08-09-2022
    Location
    Texas
    MS-Off Ver
    2016
    Posts
    6

    Re: How do I generate 6 random characters (4 numerical, 2 alpha)?

    how do we reverse it so that letters can be in front? and to generate 6 numbers

    let me know

  7. #7
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,891

    Re: How do I generate 6 random characters (4 numerical, 2 alpha)?

    Rinnycop. It is forum rule that you must not post YOUR question in anothe rperson's thread (even one that is 14 years old).

    Please start your OWN thread, using a suitabkle sampel fiel for us to play with,
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

Closed 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