+ Reply to Thread
Results 1 to 4 of 4

Monte Carlo Simulation

  1. #1
    Registered User
    Join Date
    07-19-2007
    Posts
    11

    Monte Carlo Simulation

    I have a series of formulas that calculate data using the RAND function, so I get a different result every time I do a re-calc. I would like to re-calc a thousand times and capture the result in a thousand different cells, so I can look for long-term trends. Any ideas?

    Or if not possible, can I get Excel to do a re-calc a thousand times and record the average result of all thousand runs.

    Thanks
    Phil

  2. #2
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229
    This might help you.
    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    11-11-2005
    Posts
    267
    Another idea. Assuming your formula is in the range A1:A25 covering only 25 cells and you wish to have the range recalculate 1000x. Assuming again that the results needed are SUM, AVERAGE and STANDARD DEVIATION, you can collect these results by code and transfer them onto the worksheet, in my example, in Columns C,D and E. Here is the code:

    Sub MonSimu()
    Dim i%, n%
    Range("C1") = "SUM"
    Range("D1") = "AVERAGE"
    Range("E1") = "STDEV"
    n = 2
    For i = 1 To 1000
    Calculate
    Cells(n, 3) = Application.Sum(Range("a1:a25"))
    Cells(n, 4) = Application.Average(Range("a1:a25"))
    Cells(n, 5) = Application.StDev(Range("a1:a25"))
    n = n + 1
    Next
    End Sub
    This should get you started.
    HTH
    Myles

    ...constantly looking for the smoother pebble while the whole ocean of truth lies before me.

  4. #4
    Registered User
    Join Date
    07-19-2007
    Posts
    11
    Mike, Myles,
    Thanks very much for you suggestions. I will try them out and let you know how it goes.
    Phil

+ 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