+ Reply to Thread
Results 1 to 9 of 9

Generating random time in excel 2010

  1. #1
    Forum Contributor
    Join Date
    11-10-2019
    Location
    India
    MS-Off Ver
    2013
    Posts
    350

    Generating random time in excel 2010

    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

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,779

    Re: Generating random time in excel 2010

    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.

  3. #3
    Forum Expert
    Join Date
    10-10-2016
    Location
    Sheffield
    MS-Off Ver
    365 and rarely 2016
    Posts
    3,212

    Re: Generating random time in excel 2010

    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?

  4. #4
    Forum Expert
    Join Date
    12-09-2014
    Location
    Trakai, Lithuania
    MS-Off Ver
    2016
    Posts
    1,292

    Re: Generating random time in excel 2010

    A1-09:00:00
    A2
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Drop down
    Attached Files Attached Files

  5. #5
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,779

    Re: Generating random time in excel 2010

    @Czeslaw

    That's not random, though, is it?

  6. #6
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,820

    Re: Generating random time in excel 2010

    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?
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  7. #7
    Valued Forum Contributor
    Join Date
    07-13-2021
    Location
    California, USA
    MS-Off Ver
    2010
    Posts
    513

    Re: Generating random time in excel 2010

    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.

  8. #8
    Forum Expert
    Join Date
    10-10-2016
    Location
    Sheffield
    MS-Off Ver
    365 and rarely 2016
    Posts
    3,212

    Re: Generating random time in excel 2010

    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!

  9. #9
    Forum Contributor
    Join Date
    11-10-2019
    Location
    India
    MS-Off Ver
    2013
    Posts
    350

    Re: Generating random time in excel 2010

    Quote Originally Posted by Czeslaw View Post
    A1-09:00:00
    A2
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Drop down
    Yes Thank U

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Random number generator not always generating random numbers
    By Murman01 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-03-2021, 05:29 PM
  2. Replies: 3
    Last Post: 09-05-2016, 08:34 PM
  3. [SOLVED] Generating bar code in Excel 2010
    By someko in forum Excel General
    Replies: 1
    Last Post: 08-01-2014, 10:30 AM
  4. Replies: 1
    Last Post: 04-24-2014, 01:33 PM
  5. Generating a list of Random numbers of random length...
    By Growl in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-19-2013, 12:10 PM
  6. Generating a random set of numbers within Excel
    By Phantomnz in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 03-28-2013, 03:50 AM
  7. [SOLVED] Generating Correlated Random Values in Excel
    By Randy in forum Excel General
    Replies: 2
    Last Post: 01-16-2005, 06:06 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1