+ Reply to Thread
Results 1 to 7 of 7

Using RANDBETWEEN

  1. #1
    Registered User
    Join Date
    08-23-2017
    Location
    Glasgow
    MS-Off Ver
    2003
    Posts
    4

    Using RANDBETWEEN

    Hi,
    I'm trying unsuccessfully, using various connotations of RANDBETWEEN, to enter a random time between say 20:18 and 20:30 (hh:mm) or 00:05 and 00:15 (If I use 20:18 I get a circular reference error.)
    I can insert a random numbers, =RANDBETWEEN(1,5) without a problem but if I try =RANDBETWEEN(20.18,20.30) I get 00.00.
    I've converted the times to numbers =RANDBETWEEN(0.8458333333,0.8541666667) and still get 00.00

    Any help would be greatly appreciated.

    Thanks,
    Brian

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Using RANDBETWEEN

    Brian

    RANDBETWEEN is for integers but you could still use it, along with the TIME function, to do what you want.

    For between 20:18 and 20:30,

    =TIME(20, RANDBETWEEN(18,30),0)

    and between 00:05 and 00:15

    =TIME(00, RANDBETWEEN(5, 15),0)
    If posting code please use code tags, see here.

  3. #3
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Using RANDBETWEEN

    RANBETWEEN accepts and returns integer values.

    A
    B
    1
    20:22
    A1: =RANDBETWEEN("20:18"*1440, "20:30"*1440)/1440
    2
    20:25
    3
    20:25
    4
    20:22
    5
    20:23
    6
    20:21
    7
    20:29
    8
    20:18
    9
    20:22
    10
    20:18
    Entia non sunt multiplicanda sine necessitate

  4. #4
    Registered User
    Join Date
    08-23-2017
    Location
    Glasgow
    MS-Off Ver
    2003
    Posts
    4

    Re: Using RANDBETWEEN

    Norie,
    Thank you, thank you, thank you.
    I've been struggling with this, on and off for the last 3 days and couldn't even get close to it, you're a life saver.

  5. #5
    Registered User
    Join Date
    08-23-2017
    Location
    Glasgow
    MS-Off Ver
    2003
    Posts
    4

    Re: Using RANDBETWEEN

    Thanks very much shg,
    works perfectly, will you kindly explain to me the relevance of the 1440 for me amending the formulae to suit various times.

  6. #6
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Using RANDBETWEEN

    1440 is the number of minutes in a day -- it converts time to minutes.

  7. #7
    Registered User
    Join Date
    08-23-2017
    Location
    Glasgow
    MS-Off Ver
    2003
    Posts
    4

    Re: Using RANDBETWEEN

    So it's static, thank you shg, you're very helpful and I appreciate your help immeasurably.

    Kind regards,

    Brian.

+ 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. randbetween PLEASE HELP ME
    By emily_brou in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-22-2015, 05:47 AM
  2. Replies: 10
    Last Post: 07-03-2015, 04:29 PM
  3. [SOLVED] Randbetween
    By ASPENCO in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 07-03-2013, 01:54 AM
  4. randbetween different than
    By Ramzes in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-16-2011, 08:29 AM
  5. Excel 2007 : Randbetween
    By frever in forum Excel General
    Replies: 0
    Last Post: 09-10-2010, 05:39 AM
  6. Excel 2007 : Randbetween
    By Iandislikesformulas in forum Excel General
    Replies: 4
    Last Post: 08-31-2010, 08:42 PM
  7. randbetween
    By [email protected] in forum Excel General
    Replies: 1
    Last Post: 11-21-2005, 09:30 AM

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