Imagine that you need to create random combinations of letters in Excel. In this example I want to create a 3 letters random combinations list. I want the result to be like this:
TEX |
JYY |
QCX |
CDH |
NTW |
To get this kind of combinations I used the following formula:
=CHAR(RANDBETWEEN(65,90))&CHAR(RANDBETWEEN(65,90))&CHAR(RANDBETWEEN(65,90))
I’ve used the RANDBETWEEN() function to generate values between 65 and 90 because they are the ANSI codes of letters A to Z. The RANDBETWEEM() function has the following arguments:
RANDBETWEEN(bottom,top)
bottom is the smallest integer that the function will return and top is the highest.
After the generation of the random number, I use CHAR() function to return the corresponding character from the ANSI table of characters. This function has the following syntax:
CHAR(number)
number is a number between 1 and 255 that specifies which character we want to return.
On my formula, combining 3 times the formula CHAR(RANDBETWEEN(65,90) I get a combination of 3 letters.
If I wanted to get a random list of numbers between 100 and 1000, I could use the following formula:
=RANDBETWEEN(100,1000)
This will give me a list of number like the one below:
941 |
486 |
970 |
952 |
376 |