Late Post

The way to generate random letters in Excel

It is simple to return random values in Microsoft Excel, however returning random letters may go away you scratching your head. Luckily, you solely want two capabilities.

Picture: PixieMe/Shutterstock

Excel supplies three capabilities for producing random values: RAND(), RANDARRAY(), and RANDBETWEEN(), however there is no comparable operate for producing random letters. The reality is, most of will not have to generate random numbers, however in the event you do, you wish to achieve this shortly, proper? Luckily, by combining a few capabilities, you may generate random letters. On this article, I will evaluation these two capabilities after which present you learn how to mix them to get fast outcomes.

SEE: 83 Excel suggestions each consumer ought to grasp (TechRepublic)

I am utilizing Microsoft 365 on a Home windows 10 64-bit system, however you should use earlier variations by way of Excel 2007. On your comfort, you may obtain the demonstration .xlsx and .xls recordsdata. Excel On-line helps these capabilities.

About RANDBETWEEN() and CHAR() in Excel

You are in all probability aware of each of those capabilities already, but it surely may by no means happen to you to make use of them collectively. Luckily, they play properly collectively.

First, let’s evaluation RANDBETWEEN(). This operate returns a random integer worth between two specified values, each time the sheet is calculated. That final half is necessary, and we’ll get again to that later. Its syntax,

RANDBETWEEN(backside, prime)

has two required arguments: Backside specifies the small integer that may be returned, and prime specifies the most important integer that may be returned.

CHAR() returns a personality specified by a price, so it is good for translating, which is how we’ll use it. Its syntax,


has just one argument, which on this case, will likely be a price between 1 and 255. These values signify characters within the system’s character set, which was initially based mostly on ANSI and for our functions in Excel is ASCII decimal. It is uncertain you will have that info, but it surely does not harm to learn about it.  

Determine A exhibits a sheet of characters returned by the CHAR() operate utilizing the values 65 by way of 90 and 97 by way of 122. We’re not involved with the characters returned by another worth.

Determine A


  CHAR() makes use of a price between 1 and 255 to return acquainted characters.

Are you able to see the place we’re headed?

The way to mix the 2

At this level, we’ve got a operate that returns random numbers between two specified values and a operate that converts values to alphabetic characters. By combining them, we will create a operate that returns random letters.

To return a listing of random upper-case and lower-case letters, enter the next capabilities and duplicate at will:



Determine B exhibits my lists. Your lists will not match mine as a result of the outcomes are random.

Determine B


  Mix RANDBETWEEN() and CHAR() to generate random letters. 

You possibly can change the underside and prime values to cut back the variety of letters returned. For instance, in the event you wished to return random letters between e and j, you’d use the expression:


First, the RANDBETWEEN() operate returns a random letter between backside and prime. Then, the CHAR() operate interprets that worth into a personality, on this case, letters of the English alphabet.

Returning a single random letter or a collection of single random letters is pretty straightforward as soon as you understand how to mix CHAR() and RANDBETWEEN(). How would you come a random set of a couple of letter?

The way to concatenate leads to Excel

In order for you a collection of random strings, as proven in Determine C, merely concatenate two capabilities. Let’s suppose you need the primary letter to be uppercase and the second to be lowercase. On this case, you’d use the next operate:


Determine C


  Concatenate two or extra mixed capabilities. 

The primary mixed operate returns a random uppercase letter and the second returns a random lowercase letter. The & character is a concatenation operator. It merely combines the outcomes of each capabilities; it does not whole values.

You possibly can mix a number of combos for all types of strings.

The way to convert to literal values in Excel

Earlier, I discussed that RANDBETWEEN() calculates each time you calculate that workbook. Meaning each time you enter something or press F9, these capabilities return completely different characters. That may not matter, but when it does, you will wish to convert the outcomes into literal values. To shortly convert capabilities to their literal values, do the next:

  1. Choose the values.
  2. Press Ctrl + C to repeat them to the Clipboard.
  3. Within the Clipboard group (on the Residence tab), click on the Paste dropdown and select Values (V) within the Paste Values part. Doing so will change the capabilities with their outcomes.

Keep tuned

This straightforward mixture yields versatile outcomes—you may randomly return as many letters as you want. In a future article, we’ll use RANDBETWEEN() to generate random content material.

Additionally see

Source link