+ Reply to Thread
Results 1 to 2 of 2

Macro for generating random samples of data and calculating stuff

  1. #1
    Registered User
    Join Date
    04-28-2013
    Location
    Stockholm
    MS-Off Ver
    Excel 2007
    Posts
    93

    Macro for generating random samples of data and calculating stuff

    Hi, folks,

    I've been trying to write my first VBA code (or more appropriately, to modify a given code) and it has been, unsurprisingly, a fail Here's what I have to achieve:

    I have set up a portfolio, which is in the worksheet "Task". Basically, it is affected by 6 factors: the volatilities of Google, Amazon and Apple and the prices of Google, Amazon and Apple. I want to generate the following simulation: I want to replace cells C20 to C25 with randomly chosen values from the array I4:N729 (this is historical data of factor changes). I want to draw values from column I of the array to replace cell C20, values from column J to replace cell C21 and so on. I want to draw 50 values from the array (50 different numbers for each cell C20, C21, C22, C23,C24 and C25), keep the 50 portfolio value changes (cell E38) and calculate a percentile from these values. I want to do that 10 different times. However, it seems that something with my code is not working. Any help will be appreciated. Thank you!
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    04-28-2013
    Location
    Stockholm
    MS-Off Ver
    Excel 2007
    Posts
    93

    Re: Macro for generating random samples of data and calculating stuff

    Basically the problem I've got is that the cells I want replaced are replaced with completely random numbers, not the ones from the array I specified......

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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