+ Reply to Thread
Results 1 to 7 of 7

Create Relative Performance Chart But Starting Date Unknown

  1. #1
    Registered User
    Join Date
    09-23-2013
    Location
    U.S.
    MS-Off Ver
    Microsoft Office Professional Plus 2016
    Posts
    36

    Create Relative Performance Chart But Starting Date Unknown

    I'm trying to create individual charts of the performance of over 100 separate stocks going back to 1990. It's a line chart starting at 0% at the left axis (1990) and the line moves up or down based on the stock's performance until September 2013. The math for the individual points on the line chart is pretty simple: (closing price at any point in time)/(closing price in January 1990)-1.

    I'm using =INDIRECT in my primary worksheet to do the math and create the individual graphs, which pulls raw closing stock price data from another spreadsheet. The problem is that some stocks weren't trading back in 1990 and in those cases, the math is dividing the current stock price by zero. I want to avoid manually finding the first trade date for each stock (which is the denominator in every cell for a given stock) by automating the process.

    So my question: Is there a way, using the =INDIRECT function to have the formula automatically calculate performance back to the first non-zero point in time (i.e. when the stock first started trading)? The formula would need to be sophisticated enough to know which cell was the first month of non-zero data.

  2. #2
    Valued Forum Contributor
    Join Date
    02-08-2012
    Location
    Newcastle, Australia
    MS-Off Ver
    Excel 2007 and Excel 2010
    Posts
    1,429

    Re: Create Relative Performance Chart But Starting Date Unknown

    Hi,

    There is definitely a way to do what you want (either using the OFFSET function or a MATCH function), but could you please upload your workbook so that I can take a look at your data to help you develop an appropriate formula?

    Thanks

  3. #3
    Registered User
    Join Date
    09-23-2013
    Location
    U.S.
    MS-Off Ver
    Microsoft Office Professional Plus 2016
    Posts
    36

    Re: Create Relative Performance Chart But Starting Date Unknown

    Thanks. Here is a link to the file:
    https://www.sugarsync.com/pf/D451512...tDownload=true

    For simplicity, I've only included a few stocks, and their tickers are UTX, HON, BA, ECHO, FDX, and HUBG, which can be found in the tab "DATA". Go to the tab "Tables for Charts" and in cell A1 enter any of these tickers. You'll see for the companies that have been trading since 1990 (such as FDX), the calculations and chart look perfect because they have a starting stock price for January 1990. But for stocks that started trading after January 1990, it results in a #DIV/0 error. I need a way to have it start computing the stock's return based on its first trading month. I could hunt this down manually, but there are over 100 stocks in the active workbook and I want it to be a dynamic process, whereby I can add more stocks over time.

    Thanks!

  4. #4
    Valued Forum Contributor
    Join Date
    02-08-2012
    Location
    Newcastle, Australia
    MS-Off Ver
    Excel 2007 and Excel 2010
    Posts
    1,429

    Re: Create Relative Performance Chart But Starting Date Unknown

    Hi,

    All that was required was to change the formula in column B to an array formula:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    to hide the errors, and then change the source data range of the chart to a named range with the following formulae:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    for the Date Axis (I called the Named Range "DateAxis", because I'm creative like that :P), and
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    for the values (called "ChartValues").

    I hope this helps
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    09-23-2013
    Location
    U.S.
    MS-Off Ver
    Microsoft Office Professional Plus 2016
    Posts
    36

    Re: Create Relative Performance Chart But Starting Date Unknown

    Thanks! You are an Excel genius! I've been using Excel for 25 years and had never used MATCH, arrays, or created range names for charting purposes. It took me about 2 hours to get your insights above working in my active worksheet (I had to learn about those items by using some YouTube videos), but I eventually got it to work. Thank you so much! Also, thank you for teaching me how to use these new features.

  6. #6
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Create Relative Performance Chart But Starting Date Unknown

    Based on your last post in this thread, its apparent that you are satisfied with the solution(s) you've received and have solved your question, but you haven't marked your thread as "SOLVED". I will do it for you this time.

    In future, to mark your thread as Solved, you can do the following -
    Select Thread Tools-> Mark thread as Solved.

    Incase your issue is not solved, you can undo it as follows -
    Select Thread Tools-> Mark thread as Unsolved.

    Also, since you are relatively new to the forum, i would like to inform you that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post which helped you. This adds to the reputation of the person who has taken the time to help you.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  7. #7
    Valued Forum Contributor
    Join Date
    02-08-2012
    Location
    Newcastle, Australia
    MS-Off Ver
    Excel 2007 and Excel 2010
    Posts
    1,429

    Re: Create Relative Performance Chart But Starting Date Unknown

    No problems! I'm just happy to be able to share some of my knowledge with other people

+ 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. Date input as relative referencing to create average between two dates
    By KorreSporre in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-12-2013, 07:31 AM
  2. Replies: 1
    Last Post: 12-31-2011, 04:19 PM
  3. Replies: 2
    Last Post: 06-27-2011, 10:47 PM
  4. [SOLVED] Select Range with Starting Cell Unknown
    By amyxkatexx in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 11-23-2009, 01:26 PM
  5. Indexing Values to Same Starting Point for Relative Return Chart
    By Notclevr in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 01-18-2006, 06:35 PM

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