+ Reply to Thread
Results 1 to 7 of 7

Excel 2007 : Pick next large/small value

  1. #1
    Registered User
    Join Date
    04-15-2011
    Location
    Copenhagen, Denmark
    MS-Off Ver
    Excel 2011
    Posts
    32

    Pick next large/small value

    Hi,

    I have been working on this for ever, without figuring it out. Tried to explain my problem in a different thread a couple of weeks ago: http://www.excelforum.com/excel-2007...uent-data.html

    However, I have now taken a different approach. I currently have a sheet that identifies the 30 largest and smallest changes in media coverage for a set of stocks, my problem is that some changes are equal for some stocks - ie a simple VLOOKUP or INDEX only returns the first stock, I then tried som VBA to find the nth occurence (http://www.ozgrid.com/VBA/occurrence-lookup.htm), but this formula requires that i specify what occurrence I wish to return - with the amount of data I am looking at, that's not an option...

    Thus, my question is: Can I somehow tell excel to automatically find the next large occurrence (without specifying how many there are) and return the Stock name, so that I can index the stock's return in my "index-sheet"?

    Thanks in advance guys, really need help on this - my bachelor-thesis is depending on it

    /Borge
    Attached Files Attached Files

  2. #2
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Pick next large/small value

    Try these workbooks they are built using formulae and no VBa.

    Because INDIRECT() and dynamic named lists don't mix there is a trade-off in each workbook.

    1/. pickn.stocks(1).xlsx
    This uses dynamic named lists for 05/96, 06/96 (Col_05_96, Col_05_96) so that if the list in "media r.change" changes in length then the tables in "Top" & "Bottom" will compensate for this.
    The trade-off is that you will need separate tables for 05/96, 06/96 (Col_05_96, Col_05_96)

    2/. pickn.stocks(2).xlsx
    This uses static named lists for 05/96, 06/96 (Col_05_96, Col_05_96) so that if the list in "media r.change" changes in length then the named lists will have to be manually adjusted to compensate for this.
    The advantage is that we can use a drop-down in B2 to call 05/96, 06/96 (Col_05_96, Col_05_96) so only one table is required.

    3/. For both workbooks DATO, Groups, and GroupTable are dynamic names.

    4/. Your can hide/show the helper columns by toggling the Gruoping Buttons. (The +/- below the formula bar.)

    Hope this helps.

    [EDIT]
    My bachelor days might well return because of this!

    Just dawned on me, are 05/96, 06/96 part dates?
    Attached Files Attached Files
    Last edited by Marcol; 05-14-2011 at 02:54 PM.
    If you need any more information, please feel free to ask.

    However,If this takes care of your needs, please select Thread Tools from menu above and set this topic to SOLVED. It helps everybody! ....

    Also
    اس کی مدد کرتا ہے اگر
    شکریہ کہنے کے لئے سٹار کلک کریں
    If you are satisfied by any members response to your problem please consider using the small Star icon bottom left of their post to show your appreciation.

  3. #3
    Registered User
    Join Date
    04-15-2011
    Location
    Copenhagen, Denmark
    MS-Off Ver
    Excel 2011
    Posts
    32

    Re: Pick next large/small value

    Hi Marcol,

    Thanks for the reply! I will check out your workbooks tomorrow, both looks like good alternatives. 05/96, 06/96 ar part dates yes, May and June 1996. Does that make any difference..?

    My second question is: will a maximum of, say, 30 stocks be chosen? Because I have figured out a way using and if and large(XX:XX,31) to choose the ones with better or worse performance than #31, the problem here however, especially if I want to short "media losers" is that the bottom 50 or more has a 100% negative (relative) change (i.e. gone from say 1 to 0 hits), and therefor too many stocks are picked out for my portfolio...

    Haha, back to school you say?

    Cheers

  4. #4
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Pick next large/small value

    Make the Series Lists any length you wish, I used 1 to 30 as your request They can equally be 1 to 50, 1 to 10, or 10 to 30, etc.
    Any combination of Series and fixed numbers can also be used.
    For example if you want to find all the zeros start with a series 1, 2, 3, 4, 5......until a zero value is found. Now drag ths figure down until it returns a #REF error, or use this figure in pole position and fill down until it returns a #REF error.

    Play about with it to see the possible results just remember the choice from the drop-down will not return the correct result in all cases.

    The part dates might simplify the named lists a bit, but I'm brain dead tonight and of to the pub.... ....

    I'll look in tomorrow to see how you are getting on.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    04-15-2011
    Location
    Copenhagen, Denmark
    MS-Off Ver
    Excel 2011
    Posts
    32

    Re: Pick next large/small value

    Thanks again Marcol.
    This is a brilliant approach, one question though (don't have to much experience with drop-downs); will I be able to match the chosen stocks with their corresponding monthly returns for each month over the last 15 years, or will I manually have to change month in order to do so? The reason I am wondering is that I am planning to calculate the cumulative return (for the past 15 years) of the media strategy portfolio, which is rebalanced monthly based on the prior month's media coverage (i.e. the top/bottom 30 to go long/short)

  6. #6
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Pick next large/small value

    Can you post a more representative workbook?

    Say with a years worth of headers lapping 2 years and maybe a couple of hundred rows.

    If possible show an expected result and try to explain your goal somewhere on the sheet.
    Zip the file if it is to big to post.

    We could possibly define most of the named ranges using VBa as a one off, then get back to formulae.

    Filters and Subtotals might also be a distinct possibility.
    Last edited by Marcol; 05-15-2011 at 09:30 AM.

  7. #7
    Registered User
    Join Date
    04-15-2011
    Location
    Copenhagen, Denmark
    MS-Off Ver
    Excel 2011
    Posts
    32

    Re: Pick next large/small value

    I'm getting a "Database error" when trying to upload the .zip, so I've added the file to my Public folder on Dropbox: http://dl.dropbox.com/u/1719758/perc...folio.xlsx.zip

    I'm doing different approaches to the strategy, so the one I have uploaded is the percentage-approach, where I pick the X% (in this case 5%) best/worst "media-performers" to go long/short, and use dummy-variables and SUMPRODUCT to get the cumulative return.

    Hope this illustrates what I'm trying to achieve..?

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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