Generate a Random Password in Excel (With Example)


You can use the following formula to generate an 8-character random password in Excel:

=CHAR(RANDBETWEEN(65,90))&RANDBETWEEN(0,9)&CHAR(RANDBETWEEN(97,122))&CHAR(RANDBETWEEN(97,122))&CHAR(RANDBETWEEN(65,90))&RANDBETWEEN(0,9)&CHAR(RANDBETWEEN(65,90))&RANDBETWEEN(0,9)

Here is how this formula works:

  • CHAR(RANDBETWEEN(65,90)) generates a random uppercase letter
  • RANDBETWEEN(0,9) generates a random number between 0 and 9
  • CHAR(RANDBETWEEN(97,122)) generates a random lowercase letter

We then use the & symbol to concatenate each of these random values together into one string.

The following example shows how to use this formula to generate a random password in Excel in practice.

Example: Generate Random Password in Excel

We will type the following formula into cell A2 in Excel to generate a random 8-character password that contains uppercase letters, lowercase letters, and numbers:

=CHAR(RANDBETWEEN(65,90))&RANDBETWEEN(0,9)&CHAR(RANDBETWEEN(97,122))&CHAR(RANDBETWEEN(97,122))&CHAR(RANDBETWEEN(65,90))&RANDBETWEEN(0,9)&CHAR(RANDBETWEEN(65,90))&RANDBETWEEN(0,9)

The following screenshot shows how to use this formula in practice:

Excel generate random password

The formula generates the random password of U0sjA1L2.

If we double click on cell A2 and press Enter, we can generate a brand new random password:

This time the formula generates the random password of J3hkR1J4.

Note that you can use any combination of the following formulas to generate a password with a different specific length:

  • CHAR(RANDBETWEEN(65,90)) to generate a random uppercase letter
  • RANDBETWEEN(0,9) to generate a random number between 0 and 9
  • CHAR(RANDBETWEEN(97,122)) to generate a random lowercase letter
=CHAR(RANDBETWEEN(65,90))&RANDBETWEEN(0,9)&CHAR(RANDBETWEEN(97,122))

The following screenshot shows how to use this formula in practice:

This time the formula generates the random password of H5k.

Feel free to use any combination of these functions that you’d like to generate a random password with a specific length.

x