ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   random alphanumeric string (https://www.excelbanter.com/excel-worksheet-functions/5348-random-alphanumeric-string.html)

[email protected]

random alphanumeric string
 
Doe anyone know of a way to generate an alphanumeric string?

ExcelBanter AI

Answer: random alphanumeric string
 
Yes, Microsoft Excel has a built-in function that can generate random alphanumeric strings. The function is called
Formula:

RANDARRAY 

and it can be used in combination with other functions to create the desired string.

Here's how you can use the
Formula:

RANDARRAY 

function to generate a random alphanumeric string:
  1. Open a new Excel worksheet and select a cell where you want to generate the string.
  2. In the formula bar, type the following formula:
    Formula:

    =CHAR(RANDBETWEEN(65,90))&CHAR(RANDBETWEEN(65,90))&CHAR(RANDBETWEEN(48,57))&CHAR(RANDBETWEEN(48,57))&CHAR(RANDBETWEEN(97,122))&CHAR(RANDBETWEEN(97,122)) 

  3. Press Enter to generate the random alphanumeric string.

The above formula generates a string that contains two uppercase letters, two digits, and two lowercase letters. You can modify the formula to generate a string of different length or with different combinations of characters.

Note that the
Formula:

RANDARRAY 

function is only available in newer versions of Excel, such as Excel 365. If you're using an older version of Excel, you can use the
Formula:

RANDBETWEEN 

function to generate random numbers and the
Formula:

CHAR 

function to convert them to characters.

Harald Staff

For a start
=CHAR(INT(RAND()*26+65))&CHAR(INT(RAND()*26+65))&C HAR(INT(RAND()*26+65))

this is easier and better done with macro code (VBA), but this is the
worksheet function group.

HTH. Best wishes Harald

"
skrev i melding
...
Doe anyone know of a way to generate an alphanumeric string?




Dave R.

One way is to use RANDBETWEEN and CHAR(),

numbers are 47-59 and letters (cap) from 65-90.

So you might want to use a formula like this:

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

which will randomly give you a number or capital letter.. copy it to as many
columns as you like, then create some formula like

=A1&B1&C1&D1&E1

to join them together (in that case a 5 character random alphanumeric
string).



"
wrote in message
...
Doe anyone know of a way to generate an alphanumeric string?




Dave R.

Typo....numbers are 48-57, as in the formula.



"Dave R." wrote in message
...
One way is to use RANDBETWEEN and CHAR(),

numbers are 47-59 and letters (cap) from 65-90.

So you might want to use a formula like this:

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

which will randomly give you a number or capital letter.. copy it to as

many
columns as you like, then create some formula like

=A1&B1&C1&D1&E1

to join them together (in that case a 5 character random alphanumeric
string).



"
wrote in message
...
Doe anyone know of a way to generate an alphanumeric string?







All times are GMT +1. The time now is 09:44 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com