+ Reply to Thread
Results 1 to 10 of 10

XIRR with dynamic range based on date input (OFFSET)

  1. #1
    Registered User
    Join Date
    06-29-2015
    Location
    Denver, CO
    MS-Off Ver
    2013
    Posts
    4

    XIRR with dynamic range based on date input (OFFSET)

    Hello all, any help with my question is much appreciated.

    I have been trying to use the OFFSET function to calculate an XIRR based on an end date specified in the spreadsheet.

    In the attached I want to have excel calculate an XIRR based on the start date and cash flows in row 5 and then the end date based on the target date in cell B1.

    How do I need to structure the OFFSET formula to do this since the target date cell will be a variable input. So in my example attached the XIRR would calculate from row 5 to row 51 based on the target date of 12/31/2024

    Thanks
    GGG
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor nigelbloomy's Avatar
    Join Date
    11-06-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    1,011

    Re: XIRR with dynamic range based on date input (OFFSET)

    Does this get what you want?
    Please Login or Register  to view this content.
    Some people volunteer in soup kitchens or hospitals. I choose to make the world better by trying to help you with Excel. We're all learning.

    <---Click * Add Reputation for all helpful comments. It's like giving a smile.
    Forum Rules: How to mark your post [Solved] and have a happier, Excel enriched life.

  3. #3
    Registered User
    Join Date
    06-29-2015
    Location
    Denver, CO
    MS-Off Ver
    2013
    Posts
    4

    Re: XIRR with dynamic range based on date input (OFFSET)

    Thanks! That worked. The only limitation I found when converting my example into the spreadsheet I am working with is that it can't calculate a negative XIRR. It seems to default to 0%, but not a big deal.

    Thanks again
    GGG

  4. #4
    Valued Forum Contributor nigelbloomy's Avatar
    Join Date
    11-06-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    1,011

    Re: XIRR with dynamic range based on date input (OFFSET)

    Glad it basically works. Thanks for the rep too.

  5. #5
    Forum Expert
    Join Date
    05-01-2014
    Location
    California, US
    MS-Off Ver
    Excel 2010
    Posts
    1,795

    Re: XIRR with dynamic range based on date input (OFFSET)

    Quote Originally Posted by TripleG-CO View Post
    The only limitation I found when converting my example into the spreadsheet I am working with is that it can't calculate a negative XIRR. It seems to default to 0%
    FYI, Excel XIRR does not default to 0%, and it is not limited to non-negative results. It should be limited to more than -100%. But unfortunately, Excel XIRR sometimes returns results less than -100%.

    However, Excel XNPV does not work with negative discount rates. (Excel NPV does.)

    And beware that Excel XIRR sometimes returns bogus results, as well as incorrect #NUM and #DIV/0 errors, especially with unrealistic cash flows. So it is prudent to check that the Excel XIRR results does truly cause the NPV to be close to zero.

    (Use SUMPRODUCT instead of Excel XNPV, since Excel XNPV does not accept negative discount rates.)
    Last edited by joeu2004; 06-29-2015 at 04:02 PM. Reason: cosmetic

  6. #6
    Registered User
    Join Date
    06-29-2015
    Location
    Denver, CO
    MS-Off Ver
    2013
    Posts
    4

    Re: XIRR with dynamic range based on date input (OFFSET)

    What you describe on XIRR and negatives is what I would have expected and have seen before. I think it is my cash flows that is throwing it off because I have a monthly construction period and then semiannual operating periods for the cash flows. If I do a running XIRR using one construction outflow, then starting with operating inflows/outflows after that then I get the negatives I would expect.

    My issue then becomes not only how to tell excel to pick an end date for the IRR, but to also look for a dynamic start date. Not sure if excel can do both.

  7. #7
    Forum Expert
    Join Date
    05-01-2014
    Location
    California, US
    MS-Off Ver
    Excel 2010
    Posts
    1,795

    Re: XIRR with dynamic range based on date input (OFFSET)

    Quote Originally Posted by TripleG-CO View Post
    I have a monthly construction period and then semiannual operating periods for the cash flows. If I do a running XIRR using one construction outflow, then starting with operating inflows/outflows after that then I get the negatives I would expect.

    My issue then becomes not only how to tell excel to pick an end date for the IRR, but to also look for a dynamic start date.
    It is easy to specify both dynamic start and end dates. But I'm not sure the calculated IRR is truly the result that you need.

    First, I avoid using OFFSET because it is a "volatile" function. That means the formula as well as any dependent formulas are recalculated every time Excel (re)calculates any cell in any worksheet in the workbook. So I would have written the original formula as:
    Please Login or Register  to view this content.
    So if the start date is in B2, we simply replace C5 and B5 as follows:
    Please Login or Register  to view this content.
    However, that seems impractical since a cash flow on any particular start date is probably not the initial cash flow for the remaining series of cash flows.

    For example, if you just want the IRR for the semiannual operating periods, simply setting B2 to 5/31/2020 or 6/30/2020 will not calculate the intended IRR.

    Instead, I suspect you want the initial cash flow to be the sum (or NPV or NFV) of the construction cash flows ("using one construction outflow").

    Although it is not difficult to construct a dynamic sum using INDEX/MATCH again, you would need to alter the table of operating cash flows so that the initial construction sum is properly signed and in the cell before the first operating cash flow.

    I would need to presume too much in order to speculate such a change to your design.

    -----

    PS.... Of course, if you are enamored to OFFSET, I could have simply changed the nigelbloomy's formula as follows:
    Please Login or Register  to view this content.
    Last edited by joeu2004; 06-29-2015 at 05:02 PM. Reason: PS

  8. #8
    Valued Forum Contributor nigelbloomy's Avatar
    Join Date
    11-06-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    1,011

    Re: XIRR with dynamic range based on date input (OFFSET)

    @Joeu I like your construction. I forget that index can be used after a colon to create a range. Thank you for the reminder.

  9. #9
    Registered User
    Join Date
    06-29-2015
    Location
    Denver, CO
    MS-Off Ver
    2013
    Posts
    4

    Re: XIRR with dynamic range based on date input (OFFSET)

    That new formula using INDEX for the start and end dates worked in the model I am working on. I tested it against simple XIRR using fixed date range and same answer. The initial cash flow is the capital outlay for the asset, then the following cash flows are the net cash flows from operations.

    Thanks to both of you for the help.

    Any idea how to apply the same concept to the XNPV? I gave it a shot using the formula you provided and try to adjust it for NPV. Not sure if i was even close but couldn't figure out where to put a discount rate.

  10. #10
    Forum Expert
    Join Date
    05-01-2014
    Location
    California, US
    MS-Off Ver
    Excel 2010
    Posts
    1,795

    Re: XIRR with dynamic range based on date input (OFFSET)

    Quote Originally Posted by TripleG-CO View Post
    That new formula using INDEX for the start and end dates worked in the model I am working on. [....] Any idea how to apply the same concept to the XNPV?
    Since Excel XNPV does not accept negative discount rates (for no good reason), I suggest using SUMPRODUCT. The mathematical NPV formula can be found in the Excel XIRR (and XNPV) help page. For example:
    Please Login or Register  to view this content.
    where B1 is the end date, B2 is the start date, B3 is the annual discount rate, C5:C81 is the range of cash flows, and B5:B81 is the range of corresponding dates.

    PS.... It would be more efficient to put the two MATCH expressions in separate cells, and reference the cells in the SUMPRODUCT and XIRR formulas.

    FYI, with your example data, the SUMPRODUCT formula returns about -0.5089. You might not think that is "close to zero". But it is, relative to the magnitude of the cash flow values (-301M to 154M !!). My own XIRR implementation does produce a discount rate that causes the NPV to be much closer to zero (about -1.69E-8). But the difference between the two IRRs is only about 0.0000008029%.
    Last edited by joeu2004; 06-29-2015 at 08:07 PM. Reason: PS

+ 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. XIRR with dynamic range
    By j.rogne in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-05-2015, 11:30 AM
  2. XIRR with Dynamic Range
    By smorkun in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 08-27-2014, 06:15 PM
  3. using offset function to create dynamic range based on a match search
    By freddiethomas in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 02-08-2013, 05:34 AM
  4. using offset function to create dynamic range based on a match search
    By freddiethomas in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-08-2013, 04:14 AM
  5. [SOLVED] Project Timeline with Dynamic Date Range Based on User Input
    By Rollinstone12 in forum Excel General
    Replies: 2
    Last Post: 10-28-2012, 10:07 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