+ Reply to Thread
Results 1 to 2 of 2

Trying to build Function to calculate average of stock returns, with stock prices as input

  1. #1
    Registered User
    Join Date
    03-16-2017
    Location
    Toronto, Canada
    MS-Off Ver
    2013
    Posts
    1

    Trying to build Function to calculate average of stock returns, with stock prices as input

    Hello,

    I'm trying to build a UDF to calculate the average return of a stock over periods of time, based solely on the stock prices each month. I built this code in order to store the individual return values in an array, and hopefully take the average of that array, however it isn't working and i'm not sure why.

    ExcelProblem.jpg

  2. #2
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Trying to build Function to calculate average of stock returns, with stock prices as i

    You should use the code tags instead of inserting a picture.

    For one thing you don't need the as Double after Redim.

    The other thing is arrays start counting at zero.
    One spreadsheet to rule them all. One spreadsheet to find them. One spreadsheet to bring them all and at corporate, bind them.

    A picture is worth a thousand words, but a sample spreadsheet is more likely to be worked on.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 31
    Last Post: 10-28-2015, 01:54 AM
  2. Stock Prices to Returns in New Worksheet or Offset in Same Worksheet
    By Tanooki in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-06-2014, 02:14 PM
  3. Replies: 4
    Last Post: 01-29-2013, 02:26 AM
  4. Replies: 0
    Last Post: 10-28-2012, 07:22 AM
  5. Replies: 0
    Last Post: 09-25-2012, 09:39 AM
  6. challenging "share stock" average prices
    By amrezzat in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-17-2005, 08:23 AM

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