Random Letter Generator

  • Thread starter Lost in Microbiology
  • Start date
L

Lost in Microbiology

I have the alaphabet in column 1 starting at row 4. I would like for a cell
to randomly pick one of the 26 letters of the alphabet. In cell B4 I have the
following formula:

=INDEX($A$4:$A$29,INT(RANDBETWEEN(4,29)),0)

It works, every few refreshes (F9), it will give me a #REF! error. I can not
figure out why. Any help would be appreciated as this is frustrating me.

Thanks.
 
T

T. Valko

Here's one way that doesn't require you to list letters.

=CHAR(RANDBETWEEN(65,90))

That'll return the letter in uppercase.
 
L

Luke M

Your array only have 25 spots. Change the RANDBETWEEN arguement to:

RANDBETWEEN(1,26)
 
J

Jacob Skaria

=INDEX($A$4:$A$29,INT(RANDBETWEEN(4,29))-3)

If Randbetween returns 29; the array contains only 26..So adjust as above

If this post helps click Yes
 
D

Dave Peterson

First, you don't need the int() portion.

Second, =randbetween(4,29) will return values between 4 and 29.

=index(A4:A29,4) will work ok
=index(A4:A29,29) won't work ok. There aren't 29 cells in that range.

Just because your range starts in row 4, it's still indexed from 1 to 26.

=INDEX($A$4:$A$29,RANDBETWEEN(1,26),0)

Should work ok.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top