Hi
I want to generate random time between 0900 and 0915 like for example 0901 in cell A1, 0903 in cell A2, 0909 in Cell A3 and so on. How can i achieve this please
Hi
I want to generate random time between 0900 and 0915 like for example 0901 in cell A1, 0903 in cell A2, 0909 in Cell A3 and so on. How can i achieve this please
Must A3 be bigger than A2? Must A2 be bigger than A3?
More detail, please.
Ali
Enthusiastic self-taught user of MS Excel who's always learning!
Don't forget to say "thank you" in your thread to anyone who has offered you help.
You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.
Forum Rules (updated August 2023): please read them here.
As Ali says more detail please
does 9:00 have an equal chance of appearing as 9:03
can times be repeated
is the precision minutes?
A1-09:00:00
A2Formula:Please Login or Register to view this content.
Drop down
@Czeslaw
That's not random, though, is it?
Assuming that you want truly continuous, uniformly distributed, random numbers (and times in Excel are just numbers with a time format), then use the RAND() function. Help file: https://support.microsoft.com/en-us/...0-021ea9f5be73 Note in particular the first remark in the Remarks section about generating random numbers between a and b. Something like =RAND()*(TIME(9,15,0)-TIME(9,0,0))+TIME(9,0,0). Is that what you want, or are you looking for something different?
Originally Posted by shg
For random hour and random minute:
=TIME(RANDBETWEEN(0,23), RANDBETWEEN(0,59), 0)
Change the limits (e.g. 0 to 59) as desired. Replace RANDBETWEEN as desired (e.g. 9 for hours).
Caveat: When you add 3/1440 down the column, it might be prudent to round to the minute, especially if you intend to match times and/or you intend to generate a very long list (e.g. 24 hours). For example, with your short list starting at 9:00 in A1 and =A1+3/1440 in A2, note that =MATCH(TIME(9,3,0),A2,0) returns #N/A, indicating that A2 is not an exact (binary) match.
To round to the minute, use the form =--TEXT(A1+3/1440, "[h]:m") .
Last edited by curiouscat408; 12-20-2021 at 11:08 AM.
Mr Shorty
I was thinking along the same lines as you =RAND()*(TIME(9,15,0)-TIME(9,0,0))+TIME(9,0,0) but perhaps =RAND()*(TIME(9,16,0)-TIME(9,0,0))+TIME(9,0,0) if 9:15 needed an equal chance of appearing as other minutes. we will await more guidance!
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks