Managing and coming up with strong passwords can be challenging. Let us show you how you can create your own custom password generator in Excel. You can download our sample workbook below.
Random Character Generation
=CHAR(RANDBETWEEN(65,90)) (Uppercase Letter)
=CHAR(RANDBETWEEN(97,122)) (Lowercase Letter)
=RANDBETWEEN( 1, count of list items ) + ROW() / very large number that has more digits than the number of list items)
=RANK( generated random number, list of generated random numbers)
=INDEX( original list, rank of generated random number)
=CONCATENATE(all random generated characters,…)
- Type in =RANDBETWEEN(0,9) to generate a random number
- Type in =CHAR(RANDBETWEEN(65,90)) to generate an uppercase letter
- Type in =CHAR(RANDBETWEEN(97,122)) to generate a lowercase letter
- Type in =CHAR(RANDBETWEEN(33,47)) to generate a special character
- Copy all formulas to new cells to generate different characters for a 8-character length password (i.e. D3:D10)
- Select the cell from the column that is right next to list (i.e. E3)
- Type in =RANDBETWEEN(1,8)+ROW()/10000 to generate random unique numbers. Make sure the second argument of RANDBETWEEN is greater than or equal to the number of list items and the last number that divides the ROW function has more digits than the number of list items.
- Copy down the formula for the rest of the rows (i.e. E3:E10)
- Select the cell from the column that is right next to it (i.e. F3)
- Type in =RANK(E3,$E$3:$E$10) to return a list of ranks. Make sure the first argument is relative and the second is absolute that.
- Copy down the formula for the rest of the rows (i.e. F3:F10)
- Select a new cell that is to be the first cell of the shuffled list (i.e. G3)
- Type in =INDEX($D$3:$D$10,F3) to get the values from the original list in random order. Make sure the first argument is absolute and covers the original list.
- Copy down the formula for the rest of the rows (i.e. G3:G10)
- Type in or select each cell for the CONCATENATE function to combine everything and create password =CONCATENATE(G3,G4,G5,G6,G7,G8,G9,G10)
Generating Random Characters
You can generate random characters by combining the CHAR and RANDBETWEEN functions. The CHAR function returns a string character from an ANSI character code. Although you can give it numbers between 1 and 255 to get a character, not every character is suitable for passwords such as space or new line characters. Please refer to the tables below for more details.
Uppercase letters: A: 65, B: 66 … Y: 89, Z: 90
Lowercase letters: a: 97, b: 98 …y: 121, z: 122
A secure password will contain numbers, in addition to letters and symbols. Although numbers have character codes and can be called with the CHAR function, the RANDBETWEEN function can already do this on its own. This formula returns a random generated number between the minimum and maximum limits. This means that we can generate code numbers to use them with the CHAR function. For example =CHAR(RANDBETWEEN(65,90)) returns an uppercase letter.
The next step after generating the characters is to shuffle their order. If we combine them directly, all passwords would have the same pattern and be more predictable. To shuffle the list of generated characters, follow these steps:
- Generate random unique numbers using the RANDBETWEEN and the ROW functions: =RANDBETWEEN(1,8)+ROW()/10000
- Use the RANK function to get the ranks of each generated number =RANK(E3,$E$3:$E$10)
- Finally sort the new values in a new order using the INDEX function =INDEX($D$3:$D$10,F3)
For more information about shuffling process, please see: How to shuffle a list
One formula to link them all
After the shuffling step, all we need to do is combining the characters in single cell. You can use the CONCATENATE function or ampersand character (&) to do this.