+ Reply to Thread
Results 1 to 8 of 8

Generating random number string based on Alphanumeric String

  1. #1
    Registered User
    Join Date
    09-08-2013
    Location
    Aus
    MS-Off Ver
    Excel 2007
    Posts
    9

    Generating random number string based on Alphanumeric String

    Hi All,

    Wondering if it is possible to generate a random 4 digit number based off an alphanumeric string?

    Example;

    Cell A1 has 123XVF1234
    Cell A2 has 321AFW4321

    In B1 I would like to have a 4-6 digit number that is generated based on the alphanumeric data in Cell A1 (and so on down the list). If that is possible, I would also need to be able to convert back the 4-6 digit number back to its original alphanumeric value

    Example;

    If B1 returns 643562 it would need to be able to be converted back to 123XVF1234

    Any help or direction would be appreciated.

  2. #2
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Generating random number string based on Alphanumeric String

    if you are able to convert back the b1 number to A1 string it means you did not generate a random number.
    Each time you generate a random number, you generate a different number
    If solved remember to mark Thread as solved

  3. #3
    Registered User
    Join Date
    09-08-2013
    Location
    Aus
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: Generating random number string based on Alphanumeric String

    Thanks for the reply, let me change my terminology from "Random" to "Predictable" then. Since each alphanumeric string will be different, each "predictable" number that is generated should be different.

  4. #4
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Generating random number string based on Alphanumeric String

    can you accept an output as string, same lengts as source ?
    Last edited by patel45; 08-14-2014 at 09:55 AM.

  5. #5
    Registered User
    Join Date
    09-08-2013
    Location
    Aus
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: Generating random number string based on Alphanumeric String

    I would like a max of 4-6 digits ideally, I guess if it is the same length it is a start??

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

    Re: Generating random number string based on Alphanumeric String

    UDF for CRC32 checksum?

    A
    B
    C
    1
    123XVF1234 C8C7E3D6 B1: =RIGHT(DEC2HEX(GetCRC32(A1), 8), 8)
    2
    321AFW4321 7D6A0EE9
    3
    123XVF1235 BFC0D340


    Please Login or Register  to view this content.
    Entia non sunt multiplicanda sine necessitate

  7. #7
    Registered User
    Join Date
    09-08-2013
    Location
    Aus
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: Generating random number string based on Alphanumeric String

    OK so I gave that a try and this is what I get (i input and highlighted the formulas above so you could see what is applied);

    Untitled.jpg

    Not sure if this is the intention, can you provide some more detail on how this is supposed to work relating to my issue? I can see it is converting it but I don't end up with a 4-6 digit number (I need number only, not alpha numeric) and I don't see how I can convert that number back to its original value?

    Thanks again for the support.

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

    Re: Generating random number string based on Alphanumeric String

    If you want a 6-digit number,

    A
    B
    C
    1
    123XVF1234
    575894
    B1: =MOD(GetCRC32(A1), 1000000)
    2
    321AFW4321
    102633
    3
    123XVF1235
    117952


    and I don't see how I can convert that number back to its original value?
    That would be conceptually equivalent to converting a person's initials to their name, no?

+ 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. [SOLVED] Generating Random String from Text in Cells
    By abbeycrombie in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 12-18-2013, 12:09 PM
  2. [SOLVED] Need code to pull numeric data out of an alphanumeric string (string not constant)
    By harrydnyc in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-09-2013, 04:44 PM
  3. Replies: 12
    Last Post: 03-20-2013, 05:46 PM
  4. Replies: 1
    Last Post: 01-22-2013, 07:02 AM
  5. Extracting Letters and Numbers in a random Alphanumeric String
    By rajbhar_s in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-03-2010, 08:07 AM

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