Random Alphabet generation

thinksriniii

Board Regular
Joined
Apr 1, 2009
Messages
93
Hi Guys,

Could someone help whether it is possible to generate random alphabets like we do for random number using Rand() function.


Cheers,
Dave Costa
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Jon's formula does require the ATP to be installed in versions of Excel prior to 2007. The following is the same function but without the ATP dependency:

=CHAR(RAND()*26+65)
 
Upvote 0
The question I have in reference to the below random alphabetical generator formulas in excel:


=CHAR(RAND()*26+65)
Does not require ATP to be installed


=CHAR(RANDBETWEEN(65,90))
ATP to be installed in versions of Excel prior to 2007


Is there a way to make this to where the letters don't repeat themselves? Actually what I am looking for is to generate 26 characters (like that if the alphabet) in the same column but all random and no duplicate characters. Or if there is anyway to do this can you provide some aid?
 
Last edited:
Upvote 0
The question I have in reference to the below random alphabetical generator formulas in excel:


=CHAR(RAND()*26+65)
Does not require ATP to be installed


=CHAR(RANDBETWEEN(65,90))
ATP to be installed in versions of Excel prior to 2007


Is there a way to make this to where the letters don't repeat themselves? Actually what I am looking for is to generate 26 characters (like that if the alphabet) in the same column but all random and no duplicate characters. Or if there is anyway to do this can you provide some aid?
Try this...

There must be a "header cell" in the range and this header cell must not contain one of the letters. It can be an empty cell.

So, let's use cell A1 as the header cell and it'll be an empty cell.

Create this named formula:
  • Name: Nums
  • Refers to: =ROW(INDIRECT("1:26"))
Enter this array formula** in A2 and copy down to A27:

=CHAR(64+SMALL(IF(ISNA(MATCH(CHAR(64+Nums),A$1:A1,0)),Nums),INT(RAND()*(26-(ROWS(A$2:A2)-1)))+1))

** array formulas need to be entered using the key
combination of CTRL,SHIFT,ENTER (not just ENTER).
Hold down both the CTRL key and the SHIFT key
then hit ENTER.

Note that the letters will change every time a calculation takes place.
 
Upvote 0
Should it not be,

=CHAR(64 + SMALL(IF(ISNA(MATCH(CHAR(64+Nums), A$1:A1,0)), Nums), INT(RAND() * (25-(ROWS(A$2:A2)-1)))+1))
 
Upvote 0
Should it not be,

=CHAR(64 + SMALL(IF(ISNA(MATCH(CHAR(64+Nums), A$1:A1,0)), Nums), INT(RAND() * (25-(ROWS(A$2:A2)-1)))+1))
I get the correct result(s) using either. Since I used 26 that's what it should be! :stickouttounge:
 
Upvote 0
I get the correct result(s) using either. Since I used 26 that's what it should be! :stickouttounge:
Hope you're not offended by my style of humor!

To be more specific...

The 1st iteration of the formula should produce a random number from 1 to 26 to give a completely random 1st letter.

This portion of the formula does that:

INT(RAND()*(26-(ROWS(A$2:A2)-1)))+1)

For the 1st cell (A2) we can reduce that to:

INT(RAND()*26)+1

That will return a random number from 1 to 26.

If we use 25 then that 1st iteration in cell A2 becomes:

INT(RAND()*25)+1

Which will only generate random numbers from 1 to 25.

While this really doesn't effect the overall range of results for all letters it does reduce the randomness of the 1st iteration. In other words, if use 25 then we will never get the 26th smallest random result for cell A2.
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,849
Members
452,361
Latest member
d3ad3y3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top