EXCEL Random password generator

Sometimes it is useful to use Excel to generate passwords for us.

In this part we are going to make Excel generate 4-characters random passwords for us.

We are going to use two different functions for this.

  • CHAR
  • RANDBETWEEN

The CHAR function returns a character when given a valid character code. For example, =CHAR(97) will return “a”.

The RANDBETWEEN will generate a random value between a bottom and top value.

We will need to combine the above formulas and make use of the & symbol to concatenate each of these values to a 4-character string.

Lets try and enter the following formula in cell A2:

=CHAR(RANDBETWEEN(65;90))


This will give us a random uppcase letter.
ASCII uppercase characters are the letters 'A' through 'Z', which are assigned numbers 65 through 90 in the ASCII character encoding standard

Next we want a digit – from 0 to 9. Here we will use =RANDBETWEEN(0;9)

All we have to do now is to concatenate this, and do that so many times as we want characters.

For a 4-character password, insert the below formula in cell A2:

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

Drag the formula down as long as you want.


Discover more from Excel tutorials

Subscribe to get the latest posts sent to your email.

Leave a comment

I’m Henrik

Welcome to Excel tutorials made easy. This site is full of easy to follow tutorials