+ Reply to Thread
Results 1 to 4 of 4

Random Time Generator

  1. #1
    Registered User
    Join Date
    11-16-2008
    Location
    Utah
    Posts
    1

    Random Time Generator

    Hi, I am trying to run a random time generator and am uncertain
    what functions I need to include. The time is from 8:00 AM to 4:PM
    and hope someone can give me a clue.
    Thanks
    opt
    Last edited by VBA Noob; 11-17-2008 at 03:36 AM.

  2. #2
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,885
    Hi Optionistic,

    You could try a formula such as this:

    =RANDBETWEEN(333,666)/1000

    Format the cell as Time (e.g. hh:mm:ss AM/PM).

    8:00AM is stored as .333 in Excel, and 4:00PM is .667. Since RANDBETWEEN only works on integers, this method is somewhat of a work-around.

    Hope that helps!

  3. #3
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675
    This formula will give you a random time between 8 AM and 4 PM

    =(RAND()+1)/3

    If you want a generic version....

    =RAND()*(end-start)+start

    and you might want to put some rounding in there to round to the nearest minute like

    =ROUND((RAND()+1)/3*1440,0)/1440

  4. #4
    Registered User
    Join Date
    07-30-2009
    Location
    St Catharines, Ontario
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Random Time Generator

    Ok so a second part to this is how do I exclude from 12:00 - 12:30pm?
    I'm doing a time study at work and need "random" times to do the recording. our lunch is between 12 and 12:30 and obviously no one is working.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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