Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
LaStormPrep
 
Posts: n/a
Default How do I record Excel data from each Monte Carlo run?

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.
  #2   Report Post  
Posted to microsoft.public.excel.misc
vezerid
 
Posts: n/a
Default How do I record Excel data from each Monte Carlo run?

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

  #3   Report Post  
Posted to microsoft.public.excel.misc
Mike Middleton
 
Posts: n/a
Default How do I record Excel data from each Monte Carlo run?

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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel 2003, Convert EXISTING Worksheet Data to XML? [email protected] Excel Discussion (Misc queries) 4 November 16th 05 04:45 AM
can excel do Monte Carlo simulation? Prads Excel Discussion (Misc queries) 2 May 19th 05 08:28 PM
Sort pages? David Excel Discussion (Misc queries) 15 May 13th 05 11:33 PM
How can i made a monte Carlo simulation with Excel ? Bberni Excel Discussion (Misc queries) 1 April 5th 05 02:24 AM
record macros in excel and get data from webpages sbhatia Excel Worksheet Functions 1 December 15th 04 09:47 PM


All times are GMT +1. The time now is 08:52 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"