+ Reply to Thread
Results 1 to 4 of 4

Return value from a range within a range.

Hybrid View

  1. #1
    Registered User
    Join Date
    04-16-2017
    Location
    Rhode Island
    MS-Off Ver
    Excel for Mac Version 15.25
    Posts
    4

    Return value from a range within a range.

    I have end of month stock prices from 12/31/2009 through 12/31/2013 in the second column of a sheet and the corresponding date in the first column. In a separate sheet I have the years 2010, 2011, 2012, and 2013 in a column. I need to build a formula on the separate sheet that will calculate the yearly return for the corresponding year on that sepeate sheet. This has to be a single formula or else I would do a new formula for each year. I beleive I need something that will look at the year on the sheet where I am calculating the yearly return, look in the total range of price data, find the range of the data only for the correspinding year within the total data range, and then return the price on 12/31/XX by using a max function against the data and then divide that by the same thing looking for the max date (12/31) of the prior year. I don't know how to have excel look at the all the dates and then find the dates for the specific year and return the value I am looking for. Thank you.

    It kind of looks like this; data:
    12/31/2009 $XXX
    1/31/2010 $XXX
    2/28/2010 $XXX
    .
    .
    .
    .
    .
    12/31/2013 $XXX

    And the table I am trying to insert this into is just:
    Yearly Return
    2010
    2011
    2012
    2013

  2. #2
    Forum Expert
    Join Date
    12-03-2009
    Location
    Florence, Italy
    MS-Off Ver
    Excel 2019
    Posts
    1,796

    Re: Return value from a range within a range.

    Hi,

    a first example: data in sheet1, in sheet2 in A2 2010

    =SUMIF(Sheet1!A:A,DATE(A2,12,31),Sheet1!B:B)/SUMIF(Sheet1!A:A,DATE(A2-1,12,31),Sheet1!B:B)


    the segment


    SUMIF(Sheet1!A:A,DATE(A2,12,31),Sheet1!B:B)

    returns value related to Dec 31,2010

    the segment

    SUMIF(Sheet1!A:A,DATE(A2-1,12,31),Sheet1!B:B)

    returns value related to Dec 31,2009


    A sample file would be helpful
    Last edited by canapone; 04-16-2017 at 11:35 PM.
    -----------------------------------------------------

    At Excelforum, you can say "Thank you!" by clicking the star icon ("Add Reputation") below the post.

    Please, mark your thread [SOLVED] if you received your answer.

  3. #3
    Registered User
    Join Date
    04-16-2017
    Location
    Rhode Island
    MS-Off Ver
    Excel for Mac Version 15.25
    Posts
    4

    Re: Return value from a range within a range.

    Quote Originally Posted by canapone View Post
    Hi,

    a first example: data in sheet1, in sheet2 in A2 2010

    =SUMIF(Sheet1!A:A,DATE(A2,12,31),Sheet1!B:B)/SUMIF(Sheet1!A:A,DATE(A2-1,12,31),Sheet1!B:B)


    the segment


    SUMIF(Sheet1!A:A,DATE(A2,12,31),Sheet1!B:B)

    returns value related to Dec 31,2010

    the segment

    SUMIF(Sheet1!A:A,DATE(A2-1,12,31),Sheet1!B:B)

    returns value related to Dec 31,2009


    A sample file would be helpful
    Canapone, thank you for your help! I spent some more on it and came up with this:

    =((MAX((YEAR('Monthly Returns'!$A$4:$A$52)=Summary!$A9)*'Monthly Returns'!B$4:B$52))/(MAX((YEAR('Monthly Returns'!$A$4:$A$52)=(Summary!$A9-1))*'Monthly Returns'!B$4:B$52)))-1

    and then entered it an array formula and it all seems to working out when I drag the formula down for the different years and double check it against just looking at the data and finding the matching numbers and do it out algebraically! Thank you again for the help.

  4. #4
    Forum Expert
    Join Date
    12-03-2009
    Location
    Florence, Italy
    MS-Off Ver
    Excel 2019
    Posts
    1,796

    Re: Return value from a range within a range.

    Hi again

    in attachment some other formulas, a small example.

    AGGREGATE(14,...1) is available only from Excel 2010


    Regards
    Attached Files Attached Files

+ 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. [SOLVED] Return the min date in a range where an adjacent range is blank
    By ExcelRookies in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 02-07-2014, 01:32 PM
  2. [SOLVED] reference date time range, return the value into all cell that match datetime range
    By Jarvco13 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 09-22-2013, 10:39 PM
  3. Replies: 1
    Last Post: 09-04-2013, 07:23 AM
  4. Replies: 4
    Last Post: 05-22-2013, 04:15 AM
  5. [SOLVED] Query Oracle using range in Excel to return individual records for each cell in range
    By bigwillydier in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 03-18-2013, 06:37 PM
  6. Replies: 5
    Last Post: 08-29-2012, 03:53 AM
  7. I want vlookup to find a range, and return highest value in that range
    By crazie in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 11-05-2008, 01:20 PM
  8. [SOLVED] Return Range Address from Active Range
    By ExcelMonkey in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-10-2006, 08:35 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