Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 49
Default Random Letter Generator

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.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 15,768
Default Random Letter Generator

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

=CHAR(RANDBETWEEN(65,90))

That'll return the letter in uppercase.

--
Biff
Microsoft Excel MVP


"Lost in Microbiology" wrote
in message ...
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.



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,722
Default Random Letter Generator

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

RANDBETWEEN(1,26)
--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"Lost in Microbiology" wrote:

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.

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,520
Default Random Letter Generator

=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
---------------
Jacob Skaria


"Lost in Microbiology" wrote:

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.

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Random Letter Generator

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.


Lost in Microbiology wrote:

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.


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Random Generator Richard Champlin Excel Discussion (Misc queries) 15 October 26th 07 09:32 PM
Random Name Generator Smeeg Excel Worksheet Functions 5 March 3rd 06 03:25 PM
Random letter and number generator Marie1uk Excel Worksheet Functions 4 January 23rd 06 06:04 PM
random number generator Jose Luis Excel Discussion (Misc queries) 1 June 14th 05 09:41 PM
Random # Generator vamosj Excel Worksheet Functions 0 November 8th 04 07:14 PM


All times are GMT +1. The time now is 10:33 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"