+ Reply to Thread
Results 1 to 12 of 12

Sensitivity analysis issue

  1. #1
    Registered User
    Join Date
    11-11-2014
    Location
    Chicago
    MS-Off Ver
    2010
    Posts
    9

    Sensitivity analysis issue

    Hi,

    I'm trying to do a sensitivity analysis of historical S&P Prices. Basically I'm trying to find the Max, Min, and Avg of historical prices via financial quarter. I've set up my sheet with individual dates dates since 9/2/1989 in the first column and all of the closing prices in the next column, along with columns for min, max, and avg to store the results.

    Basically the trouble I've been having is I'm not sure how to segment the dates into financial quarters and only find the max, min, and avg of just those dates. For example between 6/1/1989-9/31/1989 I can find the S&P closed at its highest of $377.73. I can't, however, find a formula that I can pull through the entire list, that will find the max, min, and avg for the quarters that follow it.

    Any help that could be offered would be greatly appreciated. Thanks
    Last edited by culpepper; 11-12-2014 at 11:42 AM.

  2. #2
    Forum Contributor
    Join Date
    05-29-2013
    Location
    MD
    MS-Off Ver
    Excel 365
    Posts
    148

    Re: Help with coding

    Hi culpepper,

    I would add another column for quarter, you can use the formula:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Also a column for the year:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Now make a Pivot Table out of your data.
    Under the "Row labels" category, drag your Year column, then your Quarter column below it.

    Now drag the "Price" column into the "Values" section of the table. You can change the aggregation method to Max/Min/Avg by choosing "Value Field Settings" and then choosing the aggregation type.

    Since you want to use the same column (Price) for the 3 different aggregation methods (Min/Max/Avg), just drag it into the values section 2 more times, then change the value field settings.

    If you need help with the Pivot Table part, I would suggest googling it for a while, if you need more help, just ask.

    Thanks,
    Duncan

  3. #3
    Registered User
    Join Date
    11-11-2014
    Location
    Chicago
    MS-Off Ver
    2010
    Posts
    9

    Re: Help with coding

    Thanks for the help I really appreciate it

  4. #4
    Registered User
    Join Date
    11-11-2014
    Location
    Chicago
    MS-Off Ver
    2010
    Posts
    9

    Re: Help with coding

    Quick question: I need to pull data from the newly created pivot table (thanks by the way) based on financial quarter AND year (ex: Q1 of 2010). Is it possible to incorporate both aspects into the lookup value of a vlookup? Is there some other way to do this?

    Any help would be greatly appreciated.

  5. #5
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,936

    Re: Help with coding

    Your post does not comply with Rule 1 of our Forum RULES. Your post title should accurately and concisely describe your problem, not your anticipated solution.

    Use terms appropriate to a Google search. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will be addressed according to the OP's experience in the forum: If you have less than 10 posts, expect (and respond to) a request to change your thread title. If you have 10 or more posts, expect your post to be locked, so you can start a new thread with an appropriate title.

    To change a Title go to your first post, click EDIT then Go Advanced and change your title, if 2 days have passed ask a moderator to do it for you.

    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)
    Ben Van Johnson

  6. #6
    Forum Contributor
    Join Date
    05-29-2013
    Location
    MD
    MS-Off Ver
    Excel 365
    Posts
    148

    Re: Sensitivity analysis issue

    Hi culpepper,

    I will reply with a solution when you comply with the moderator's above request.

    Thanks,
    Duncan

  7. #7
    Forum Contributor
    Join Date
    05-29-2013
    Location
    MD
    MS-Off Ver
    Excel 365
    Posts
    148

    Re: Sensitivity analysis issue

    I see the thread title has changed:

    If you need to pull the data from the Pivot table, you can use the GETPIVOTDATA formula, which allows you to specify more than one criteria (and thus making it more useful than VLOOKUP for these things).

    Create a temporary formula in a cell by pressing "=" then clicking on one of the value cells in the pivot table. This should give you something like this:

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Change the parts of the formula that correspond to the criteria (the "2014" part and the "Q1") and replace them with references to cells that contain the criteria you want.

    Now copy the formula into whichever cells you need.

    Please add reputation if this helps you.

    Thanks,
    Duncan

  8. #8
    Registered User
    Join Date
    11-11-2014
    Location
    Chicago
    MS-Off Ver
    2010
    Posts
    9

    Re: Sensitivity analysis issue

    Any idea how to automate it, so that I can pull from 1989 Q3, 1989 Q4, 1990 Q1, etc...?
    I'm basically pulling it into a sheet that looks like thisS&P.PNG
    Appreciate all of the help

  9. #9
    Forum Contributor
    Join Date
    05-29-2013
    Location
    MD
    MS-Off Ver
    Excel 365
    Posts
    148

    Re: Sensitivity analysis issue

    My previous post was basically describing just that:

    If put the formula into the cells marked High, Low, Average and link the criteria to the cells under Quarter, Year etc, you should be fine.

    Thanks,
    Duncan

  10. #10
    Registered User
    Join Date
    11-11-2014
    Location
    Chicago
    MS-Off Ver
    2010
    Posts
    9

    Re: Sensitivity analysis issue

    I've tried it a few times, and I think my formatting might be wrong.
    I've attached a snapshot of both tabs, do you think you could give me an example formula for max price that I could extrapolate off of, say for 1989 Q3 and Q4?
    S&P.PNGpivtable.PNG
    Sorry to keep coming back to you but I'm in over my head.

    Thanks a ton

  11. #11
    Forum Contributor
    Join Date
    05-29-2013
    Location
    MD
    MS-Off Ver
    Excel 365
    Posts
    148

    Re: Sensitivity analysis issue

    So in my original reply, I said to make a temporary formula (with the intention of modifying it):

    in one of the cells in your first screenshot under the column "High", press "=" to begin a formula, and then click on (for example) cell B3 in your second screenshot. This will give you the formula for the Max of S&P 500 Index for Q3 1989.

    When you have done that, please post the formula in this thread, so I can advise on what to change.

    Thanks,
    Duncan

  12. #12
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,936

    Re: Sensitivity analysis issue

    Please post a workbook so that formulas can be tested; can't do that with pix.

    To attach a Workbook
    (please do not post pictures or links to worksheets)
    • Click Advanced (next to quick post),
    • Scroll down until you see "Manage Attachments",
    • Click that then select "add files" (top right corner).
    • Click "Select Files" find your file, click "open" click "upload"
    • Once the upload is completed the file name will appear below the input boxes in this window.
    • Click "Done" at bottom right to close the Attachment Manager.
    • Click "Submit Reply"

+ 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. macro coding help (i have no background in coding)
    By notgoodenough in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-05-2014, 10:22 PM
  2. [SOLVED] Vb macro coding for transpose - complete coding?
    By Dharani Suresh in forum Excel Programming / VBA / Macros
    Replies: 21
    Last Post: 08-02-2013, 11:16 PM
  3. [SOLVED] Vb macro coding for transpose - complete coding?
    By Dharani Suresh in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-02-2013, 05:04 AM
  4. [SOLVED] CheckBox coding to work with ComboBox coding
    By JimExcel in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-05-2013, 12:23 PM
  5. [SOLVED] Implant macro coding into ASP coding
    By Sam yong in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-15-2005, 06:05 AM

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