Random numbers!

alexjmatthews

New Member
Joined
Jan 27, 2003
Messages
7
Could someone post how to get excel to randomly select one of the following times:

08:00
00:00
02:05
04:00
12:00
14:00
16:00
18:00
20:00

Cheers for your help!
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
If you have the Analysis Toolpak installed, perhaps:

=INDEX(A:A,RANDBETWEEN(1,COUNT(A:A)))

or possibly:
=INDEX(A:A,INT(RAND()*COUNT(A:A)+1))
 
Upvote 0
Why would one use INDEX instead of OFFSET? One-based logic is feeb! Offset is zero based - like God intended! o_O

I acknowledge that, if I'm not mistaken, there an overwhelming preference for INDEX throughout the lands; God himself would lash forth with a syntax error if anyone ever deviated from the popular solution (index(match... . So everyone does it, except me. What am I missing here?! :unsure:
 
Upvote 0
Why would one use INDEX instead of OFFSET?

For me, I prefer INDEX because it's not a volatile function like OFFSET

Note: the formula

=OFFSET(A1,ROUND((COUNT(A:A)-1)*RAND(),0),)

won't give an even distribution, you'll get less instances of the first and last times in the column
 
Upvote 0
Note: the formula

=OFFSET(A1,ROUND((COUNT(A:A)-1)*RAND(),0),)

won't give an even distribution, you'll get less instances of the first and last times in the column
Oops! Got me there! /self-brain-pummel-with-hammer mode on.
 
Upvote 0

Forum statistics

Threads
1,214,944
Messages
6,122,387
Members
449,080
Latest member
Armadillos

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