ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   How do I randomly select cells regardless of cell content? (https://www.excelbanter.com/excel-worksheet-functions/215667-how-do-i-randomly-select-cells-regardless-cell-content.html)

gmadden2

How do I randomly select cells regardless of cell content?
 
I'm attempting to unconditonally and randomly select cells in a spreadsheet

Luke M

How do I randomly select cells regardless of cell content?
 
If you mean randomly find the value of a cell,
=INDEX(1:65536,INT(RAND()*65536),INT(RAND()*256))
Every time a calculation is performed, this will randomly pick a different
cell in the spreadsheet.

If you want an actual selection, you'll have to use VBA. If we knew more
about the goal/purpose, might be able to provide additional help.
--
Best Regards,

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


"gmadden2" wrote:

I'm attempting to unconditonally and randomly select cells in a spreadsheet


Bernard Liengme

How do I randomly select cells regardless of cell content?
 
To randomly select a cell from the range A1:D10, use
=INDEX(A1:D10,RANDBETWEEN(1,10),RANDBETWEEN(1,4))

RANDBETWEEN need the Analysis Toolpac (except in XL2007), or you could use
best wishes
--
Bernard V Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme
remove caps from email

"gmadden2" wrote in message
...
I'm attempting to unconditonally and randomly select cells in a
spreadsheet




Shane Devenshire

How do I randomly select cells regardless of cell content?
 
Hi,

Careful with
=INDEX(1:65536,INT(RAND()*65536),INT(RAND()*256))

RAND generates a random number between 0 and 1. Suppose the result is
<=0.00001
INDEX(1:65536,0,0) is #VALUE!

Instead
=INDEX(1:65536,INT(RAND()*65535+1),INT(RAND()*255+ 1))

--
If this helps, please click the Yes button.

Cheers,
Shane Devenshire

"Luke M" wrote in message
...
If you mean randomly find the value of a cell,
=INDEX(1:65536,INT(RAND()*65536),INT(RAND()*256))
Every time a calculation is performed, this will randomly pick a different
cell in the spreadsheet.

If you want an actual selection, you'll have to use VBA. If we knew more
about the goal/purpose, might be able to provide additional help.
--
Best Regards,

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


"gmadden2" wrote:

I'm attempting to unconditonally and randomly select cells in a
spreadsheet




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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com