Consulting

Results 1 to 8 of 8

Thread: XIRR Problem

  1. #1
    VBAX Regular
    Joined
    Jun 2015
    Posts
    10
    Location

    Question XIRR Problem

    Hi,

    I am wondering if it is possible to run XIRR until it equals 0% and then return the date on which IRR is 0%? I've been searching for an answer, but no luck yet. This is probably more complicated than I think. As always, any help is greatly appreciated. I have attached the spreadsheet I am working on.

    Final_IRR_NPV_Bond_Calc_Buttons.xlsm

  2. #2
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,729
    Location
    1. You can clean up a lot and make it faster by not using .Select

    Sub TodayDate()
        Range("A10").FormulaR1C1 = "=TODAY()+3"
    End Sub

    2. Using Option Explicit at the beginning of each module is usually a good idea

    Option ExplicitSub First()
    Call Headers
    Call TodayDate
    Call Cashflowschedule
    Call PauseTemplate
    End Sub

    3. I had to fake the Bloomsburg functions - BDP and BDS -- to return hard coded numbers

    4. These numbers are not right, but I used XIRR in the worksheet (orange) just to see the trend. The green lines are bracketing a zero crossing, but I doubt it would ever be exactly 0.000000.

    The Excel Goal Seek might work, but a user function to take the same ranges and seek for 0.00000 +/- a small number or a zero crossing (is there be such a thing) would be possible probably

    5. Can you post a WB w/o the bloomsburg functions and one that has the answer?
    Attached Files Attached Files
    ---------------------------------------------------------------------------------------------------------------------

    Paul


    Remember: Tell us WHAT you want to do, not HOW you think you want to do it

    1. Use [CODE] ....[/CODE ] Tags for readability
    [CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
    2. Upload an example
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) / Upload Files / Done
    3. Mark the thread as [Solved] when you have an answer
    Thread Tools (on the top right corner, above the first message)
    4. Read the Forum FAQ, especially the part about cross-posting in other forums
    http://www.vbaexpress.com/forum/faq...._new_faq_item3

  3. #3
    VBAX Regular
    Joined
    Jun 2015
    Posts
    10
    Location
    Paul,

    thank you for your help and suggestions, I learn new skills everyday. As you can probably tell from my code, I am a beginner and am learning day-by-day. I'll play around with your approach and will report back.

  4. #4
    VBAX Regular
    Joined
    Jun 2015
    Posts
    10
    Location
    Sub IRR()
    
    
    ' Autofill IRR from Cell F10
    
    
        Range("F10").Select
        ActiveCell.FormulaR1C1 = "=XIRR(R10C2:RC[-4],R10C1,RC[-5])"
        Range("F10").Select
        Selection.AutoFill Destination:=Range("F10", Range("A10").End(xlDown))
    
    
    End Sub
    What I am trying to replicate is the automatic IRR calculation in the right coulumn, in my case starting in cell "F10". I can't get it to stop where column A and B stop, these are dynamic ranges and vary from security to security. Any ideas?

    In addition, I'll add a GoalSeek function as soon as I have figured out this IRR calculation. Thank you for your help!

  5. #5
    VBAX Regular
    Joined
    Jun 2015
    Posts
    10
    Location
    Sub IRR()
    
    
    ' Autofill IRR from Cell F10
        Dim RC As Long
        RC = Range("A" & Rows.Count).End(xlUp).Row
        Range("F10:F" & RC).FormulaR1C1 = "=XIRR(R10C2:RC[-4],R10C1,RC[-5])"
        Range("F10:F" & RC).Select
        Selection.NumberFormat = "0.00%"
    
    
    End Sub
    I found a solution. Now I am getting an error in F10= #N/A and F11 down = #NUM! It's not showing the values...

  6. #6
    VBAX Regular
    Joined
    Jun 2015
    Posts
    10
    Location
    I think I found the solution. Sorry for all these posts. Thank you for your help.

  7. #7
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,729
    Location
    I am wondering if it is possible to run XIRR until it equals 0% and then return the date on which IRR is 0%?

    Does that find the date for 0%?
    ---------------------------------------------------------------------------------------------------------------------

    Paul


    Remember: Tell us WHAT you want to do, not HOW you think you want to do it

    1. Use [CODE] ....[/CODE ] Tags for readability
    [CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
    2. Upload an example
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) / Upload Files / Done
    3. Mark the thread as [Solved] when you have an answer
    Thread Tools (on the top right corner, above the first message)
    4. Read the Forum FAQ, especially the part about cross-posting in other forums
    http://www.vbaexpress.com/forum/faq...._new_faq_item3

  8. #8
    VBAX Regular
    Joined
    Jun 2015
    Posts
    10
    Location
    No, it doesn't find the exact date. However, by calculating each individual IRR, I can see what CF will be close to 0% and look at that coupon's payment date. I have a range, rather than an exact date, which is ok.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •