PC Review


Reply
Thread Tools Rate Thread

How do I record Excel data from each Monte Carlo run?

 
 
=?Utf-8?B?TGFTdG9ybVByZXA=?=
Guest
Posts: n/a
 
      8th May 2006
I am running multiple Marte Carlo simulations involving 300 iterations per
run. I want to automatically record the data from each run so that I can
build a better data base.
 
Reply With Quote
 
 
 
 
vezerid
Guest
Posts: n/a
 
      8th May 2006
Hi,

the following macro assumes that your system will run a new simulation
using the F9 key, i.e. simple calculation. It writes to a destination
worksheet named Target Sheet. It stores 10 output cells, starting with
B4 and G2 and ends with X3.

It provides for up to 65535 simulations. You can start from row 1 if
you don't need headers. The code can be changed with a loop in its
core, if output data is a table. It can be modified to much more rows,
or you might find an already made variant for Access or some DBMS in
..programming.

Sub SimAndStore()
Dim dest As Worksheet
Dim i As Long
Dim destcell As Range

Set dest = Sheets("Target Sheet")
Application.Calculation = xlCalculationManual
For i = 2 To 65536
Application.Calculate
Set destcell = dest.Cells(i, 1)
destcell.Cells(1, 1) = Range("B4")
destcell.Cells(1, 2) = Range("G2")
'...
destcell.Cells(1, 10) = Range("X3")
Next i
Application.Calculation = xlCalculationAutomatic
End Sub

HTH
Kostis Vezerides

 
Reply With Quote
 
Mike Middleton
Guest
Posts: n/a
 
      8th May 2006
LaStormPrep -

> I am running multiple Marte Carlo simulations involving 300 iterations per
> run. I want to automatically record the data from each run so that I can
> build a better data base. <


Assuming you have a model with random inputs and a single output, one method
is to use the Data Table command: a column of "trial" numbers, 1 to 300; a
formula at the top of an adjacent column on the right, usually just a
reference to the cell containing the output formula of your model; select
both columns, including the blank cell at the top of the column on the left,
and enter any unused cell as the "Column Input Cell" in the Data Table
dialog box.

- Mike
www.mikemiddleton.com


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to use Monte Carlo Simulation in Excel? Suparna Microsoft Excel Misc 7 5th Jun 2008 04:58 AM
HOw to use Monte cARLO sIMULATION IN eXCEL? Suparna Microsoft Excel Misc 1 1st Jun 2008 05:29 PM
can excel do Monte Carlo simulation? =?Utf-8?B?UHJhZHM=?= Microsoft Excel Misc 2 19th May 2005 08:28 PM
How can i set up a MONTE CARLO SIMULATION macro in Excel? thx =?Utf-8?B?TW9udGVVc2Vy?= Microsoft Excel Worksheet Functions 4 14th May 2005 03:29 PM
How can i made a monte Carlo simulation with Excel ? =?Utf-8?B?QmJlcm5p?= Microsoft Excel Misc 1 5th Apr 2005 02:24 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:17 PM.