Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
kckar
 
Posts: n/a
Default is there a way to use rand() to select a cell


is there a way to use the rand function to select a random cell?

so if i want a random cell in column a i would put like A(rand()??


--
kckar
------------------------------------------------------------------------
kckar's Profile: http://www.excelforum.com/member.php...o&userid=25322
View this thread: http://www.excelforum.com/showthread...hreadid=513085

  #2   Report Post  
Posted to microsoft.public.excel.misc
Bob Phillips
 
Posts: n/a
Default is there a way to use rand() to select a cell

Is this any good?

=INDIRECT("A"&RANDBETWEEN(1,1000))

--

HTH

Bob Phillips

(remove nothere from the email address if mailing direct)

"kckar" wrote in
message ...

is there a way to use the rand function to select a random cell?

so if i want a random cell in column a i would put like A(rand()??


--
kckar
------------------------------------------------------------------------
kckar's Profile:

http://www.excelforum.com/member.php...o&userid=25322
View this thread: http://www.excelforum.com/showthread...hreadid=513085



  #3   Report Post  
Posted to microsoft.public.excel.misc
Ken Johnson
 
Posts: n/a
Default is there a way to use rand() to select a cell

Hi kckar,
The only way I know of is to use a macro.
The following event procedure will select a random cell in the range
A1:A30 when you select B1...

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address < "$B$1" Then Exit Sub
Dim iRow As Long
iRow = Int(Rnd * 29 + 1)
Cells(iRow, 1).Select
End Sub

To get the code in place...
1. Copy the 6 code lines
2. Right click the sheet tab of the applicable worksheet
3. Select View code from the contextual pop up menu to enter the
appropriate part of the VBA Editor
4. Paste the code into the white space (worksheet code module)
5. File -- Save
6. Alt + F11 to return to the workbook.

The security level must be no higher than Medium for the macro to work,
and Enable Macros must be clicked on the Security Warning dialog when
opened. Tools -- Macro -- Security to change security if it is too
high, close -- open to apply new security level.

Ken Johnson

  #4   Report Post  
Posted to microsoft.public.excel.misc
wdjsxj
 
Posts: n/a
Default is there a way to use rand() to select a cell

is it all right?
=INDIRECT("A"&INT((RAND()*100)))


€œkckar€ç¼–写:


is there a way to use the rand function to select a random cell?

so if i want a random cell in column a i would put like A(rand()??


--
kckar
------------------------------------------------------------------------
kckar's Profile: http://www.excelforum.com/member.php...o&userid=25322
View this thread: http://www.excelforum.com/showthread...hreadid=513085


  #5   Report Post  
Posted to microsoft.public.excel.misc
nsv
 
Posts: n/a
Default is there a way to use rand() to select a cell


I imagine you want the contents of that randomly chosen cell rather than
just the cell number:
=INDIRECT(ADDRESS(RAND()*65536;RAND()*256))

This gives the contents of any random cell on the sheet. Press F9 to
choose another. Limit the area in which you pick your cells by using
figures less than 65536 (number of rows) and 256 (number of columns).

The ADDRESS-function uses only the integer part of the number, so INT
is not necessary.


--
nsv
------------------------------------------------------------------------
nsv's Profile: http://www.excelforum.com/member.php...o&userid=26500
View this thread: http://www.excelforum.com/showthread...hreadid=513085



  #6   Report Post  
Posted to microsoft.public.excel.misc
 
Posts: n/a
Default is there a way to use rand() to select a cell

Hello,

I think you meant
=INDIRECT(ADDRESS(1+RAND()*65536,1+RAND()*256))

Regards,
bernd

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
I cannot select a single cell or pull down cell contents Carolyn Fahm Excel Worksheet Functions 0 January 24th 06 04:54 PM
Select cell, Copy it, Paste it, Return to Previous cell spydor Excel Discussion (Misc queries) 1 December 30th 05 01:29 PM
Select cell containing specific text &return value from another ce plf100 Excel Worksheet Functions 4 November 16th 05 01:57 PM
enhanced conditional formatting Stuart Excel Discussion (Misc queries) 13 November 13th 05 07:20 PM
select a cell and the one next to it Donna S Excel Discussion (Misc queries) 3 November 4th 05 06:53 PM


All times are GMT +1. The time now is 10:12 AM.

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

About Us

"It's about Microsoft Excel"