+ Reply to Thread
Results 1 to 11 of 11

IRR formula with dynamic year range

  1. #1
    Registered User
    Join Date
    02-07-2012
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    15

    IRR formula with dynamic year range

    How can I adjust the IRR formula depending on how many years I'm looking at.
    My cash flows are starting in cell J13 and depending on the input factors (years) the last cell can be anything from K13 (1 year) to AH13 (25 years).
    I have worked out how to define the last cell by doing =ADDRESS(ROW(I12),10+(COUNT(J2:AQ2)-1)) - Row 2 are the relevant years

    Can i somehow tell excel to do =XIRR(I12:S12,I2:S2) where i substitute to something like =XIRR(I12;ADDRESS(ROW(I12),10+(COUNT(J2:AQ2)-1)).....

    The aim is that excel picks up the last cell that contains a data and puts this cell reference into the XIRR formula. Is that possible without VBA?

  2. #2
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,829

    Re: IRR formula with dynamic year range

    It is possible. Rather than the ADDRESS() function, I would be inclined to use the OFFSET() function instead: https://support.office.com/en-us/art...e-b4d906d11b66 (hint: your COUNT() function goes in the "width" argument)
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  3. #3
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: IRR formula with dynamic year range

    Sounds like OFFSET will do what you need - I'm getting confused by your cell references, though, so attach a sample workbook if you need a more specific answer!
    let Source = #table({"Question","Thread", "User"},{{"Answered","Mark Solved", "Add Reputation"}}) in Source

    If I give you Power Query (Get & Transform Data) code, and you don't know what to do with it, then CLICK HERE

    Walking the tightrope between genius and eejit...

  4. #4
    Registered User
    Join Date
    02-07-2012
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    15

    Re: IRR formula with dynamic year range

    Thanks for your initial responses. Maybe to make it easier. How do i tweak an XIRR formula in general?
    anything i have tried to deviate from the standard XIRR(values, dates, [guess])and replace the "values" or "dates" with formulas i've failed.

  5. #5
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: IRR formula with dynamic year range

    You 'tweak' it exactly like any other formula, by passing the arguments required.

    Example: with dates in Column A, Values in Column B, you might write something like:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Now to adjust this for an 'unknown' number of dates / values, you might change it to something like:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    So if you are failing with your formula adjustments, then you're getting the OFFSET function wrong.

    Why not post an (anonymized) example of your worksheet structure, and what you are trying, so that we can offer more meaningful examples?

  6. #6
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,829

    Re: IRR formula with dynamic year range

    Your OP suggests that your ranges are going across columns rather than down rows. However Olly's example should still work just fine, except you may need to switch the height and width arguments in his OFFSET() functions. Olly's example shows the COUNT() function in the height argument, where you may need it in the width argument.

  7. #7
    Registered User
    Join Date
    02-07-2012
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    15

    Re: IRR formula with dynamic year range

    yes my data is indeed in rows and not in columns. Whatever i do i get "too many arguments...."
    Attached Files Attached Files

  8. #8
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,829

    Re: IRR formula with dynamic year range

    It might help to see what you have tried. "too many arguments", especially when nesting functions multi-levels deep, is often indicating that you are not being careful about parentheses and commas/semicolon delimiting arguments, and syntax stuff like that. Look at the attempts you have tried and carefully count parentheses and make sure the opening and closing parentheses are all where they should be.

  9. #9
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,569

    Re: IRR formula with dynamic year range

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

    Let us know if you have any questions.
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

  10. #10
    Registered User
    Join Date
    02-07-2012
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    15

    Re: IRR formula with dynamic year range

    cool - thank you
    much appreciated

  11. #11
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,569

    Re: IRR formula with dynamic year range

    You're Welcome and thank you for the feedback. Please take a moment to mark the thread as 'Solved' using the thread tools link above your first post. I hope that you have a blessed day.

+ 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] SUMIF formula with dynamic column range and then expand the width of SUM range
    By gravythief in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 04-26-2017, 08:36 AM
  2. [SOLVED] Dynamic month and year criteria in Sumifs formula
    By 4gurus in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 03-19-2016, 08:19 AM
  3. [SOLVED] chart based on dynamic range which resizes as per data in range-formula / vba
    By KK1234 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-11-2014, 04:02 PM
  4. Replies: 0
    Last Post: 11-23-2012, 01:27 AM
  5. [SOLVED] Dynamic Year to date formula
    By tomjoe in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 08-25-2012, 06:16 PM
  6. Replies: 3
    Last Post: 03-12-2009, 09:54 AM
  7. Replies: 2
    Last Post: 02-02-2006, 04:10 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