+ Reply to Thread
Results 1 to 4 of 4

Function to Generate Random Numbers and Letters

  1. #1
    Registered User
    Join Date
    07-22-2010
    Location
    Ontario
    MS-Off Ver
    Excel 2003
    Posts
    71

    Function to Generate Random Numbers and Letters

    Hi there,

    I need your help in designing a custom Macro/Function to automatically generate a series of random number and a separate function to generate a random series of letters.

    The syntax would be as follows:

    Rand_Num(1,1000) - this function would generate a random series of numbers from 1 to 9999 eg. 6518

    Next. I need a separate function to generate a random series of letters. The syntax would be as follows: Rand_Ltr(4,A-Z)

    So this function would return four letters that are randomized from A-Z eg. KTMR

    Any help with this is greatly appreciated.

    Thanks in advance,

    Cheers,

    Jason

  2. #2
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,602

    Re: Function to Generate Random Numbers and Letters

    maybe this:

    =CHAR(CHOOSE(RANDBETWEEN(1,2), RANDBETWEEN(48,57), RANDBETWEEN(65,90)))

    This will give you 50% for getting number or letter.

    You can join severl of them to create string.

    Or only this for 4 letters:

    =CHAR(RANDBETWEEN(65,90))&CHAR(RANDBETWEEN(65,90))&CHAR(RANDBETWEEN(65,90))&CHAR(RANDBETWEEN(65,90))

  3. #3
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Function to Generate Random Numbers and Letters

    Please Login or Register  to view this content.



  4. #4
    Registered User
    Join Date
    07-22-2010
    Location
    Ontario
    MS-Off Ver
    Excel 2003
    Posts
    71

    Re: Function to Generate Random Numbers and Letters

    Thanks very much for all the helpful replies.

+ 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