+ Reply to Thread
Results 1 to 6 of 6

How to 'freeze' the output generated by RAND()?

  1. #1
    Registered User
    Join Date
    02-08-2006
    Posts
    12

    How to 'freeze' the output generated by RAND()?

    Hi all,
    This is my first post in this forum and I wonder if anyone could help me...

    I have a column(a1:A11) of numbers generated by RAND(). But it is really
    annoying that it will re-calculate the outputs everytime!
    Is it possible to use RAND() to randomise for one time only??

    THANKS!

    George Lin

  2. #2
    Forum Expert
    Join Date
    09-09-2005
    Location
    England
    MS-Off Ver
    2007
    Posts
    1,500
    The simple solution is to select the cells and post special values back on top of the cells. This will leave them fixed for ever as they will now just be values

    Regards

    Dav

  3. #3
    Bob Phillips
    Guest

    Re: How to 'freeze' the output generated by RAND()?

    Two ways.

    Either copy the random values and then Edit>Pastespecial and check Values,

    or

    First, goto Tools>Options>Calculation and check the Iteration box to stop
    the circular references message, and then in A1, use

    =IF($B$1<>"",A1,RAND())

    copy this down as far as you want. This will recalculate until you enter a
    value in B1, it will then lock.

    With the second method, any real circular references messages will be
    suppressed.

    --

    HTH

    Bob Phillips

    (remove nothere from the email address if mailing direct)

    "hello_lpc" <[email protected]> wrote
    in message news:[email protected]...
    >
    > Hi all,
    > This is my first post in this forum and I wonder if anyone could help
    > me...
    >
    > I have a column(a1:A11) of numbers generated by RAND(). But it is
    > really
    > annoying that it will re-calculate the outputs everytime!
    > Is it possible to use RAND() to randomise for one time only??
    >
    > THANKS!
    >
    > George Lin
    >
    >
    > --
    > hello_lpc
    > ------------------------------------------------------------------------
    > hello_lpc's Profile:

    http://www.excelforum.com/member.php...o&userid=31304
    > View this thread: http://www.excelforum.com/showthread...hreadid=509935
    >




  4. #4
    Registered User
    Join Date
    02-08-2006
    Posts
    12
    Quote Originally Posted by Dav
    The simple solution is to select the cells and post special values back on top of the cells. This will leave them fixed for ever as they will now just be values

    Regards

    Dav
    Thanks Dav, that really helps!

    George

  5. #5
    Registered User
    Join Date
    02-08-2006
    Posts
    12
    Quote Originally Posted by Bob Phillips
    Two ways.

    Either copy the random values and then Edit>Pastespecial and check Values,

    or

    First, goto Tools>Options>Calculation and check the Iteration box to stop
    the circular references message, and then in A1, use

    =IF($B$1<>"",A1,RAND())

    copy this down as far as you want. This will recalculate until you enter a
    value in B1, it will then lock.

    With the second method, any real circular references messages will be
    suppressed.

    --

    HTH

    Bob Phillips
    Thanks for your help,Bob
    Last edited by hello_lpc; 02-08-2006 at 10:57 AM.

  6. #6

    RE: How to 'freeze' the output generated by RAND()?

    "hello_lpc" wrote:
    > I have a column(a1:A11) of numbers generated by RAND().
    > But it is really annoying that it will re-calculate the outputs
    > everytime!


    ..... Every time there is a change __anywhere__ in the
    spreadsheet! Annoying, to say the least. It makes RAND()
    almost useless, IMHO.

    > Is it possible to use RAND() to randomise for one time only??


    I replace all uses of RAND() with myrand() after creating the
    following macro:

    1. Type alt-F11 to enter the VB editor.
    2. Cick Insert > Module.
    3. Enter the following, then close the VBE window:

    function myrand(optional rng)
    myrand = rnd()
    end function

    You can use this in either of the following ways: myrand(),
    myrand(A1), or myrand(A1:C1).

    Thus, random values are recalculated only when the entire
    spreadsheet (or the cell or range passed to "rng") is recalculated.

+ 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