Results 1 to 3 of 3
  1. #1
    Mpike926's Avatar
    Mpike926 is offline Advanced Beginner
    Windows 7 32bit Access 2010 64bit
    Join Date
    May 2012
    Location
    Florida
    Posts
    43

    IRR Formula in VBA

    Hi all, So for background, I have a continuous form that consists of 60 records per one record. These 60 records are for cashflow entries over the period of 60 months.
    We recently had a deal that we need to hold longer than 60 months, so I added 24 more months to it to extend the total to 84 records for the one record (Asset)
    The IRR formula I have will calculate for the first 60 months, but after the 60 months, any cash after that entered, does not get factored into the IRR. I dont know what I am doing wrong, as I did not originally write the script. Any help would be appreciated. Thank You!

    Code:

    'do the IRR for recommended strategy


    On Error GoTo ErrRecommended

    qryString = "Select * from tblCashFlow where LoanID = " & Me.ID.Value & "and Strategy = 'Recommended' order by CFDate"
    Set rsCF = db.OpenRecordset(qryString, dbOpenDynaset, dbSeeChanges)
    rsCF.MoveFirst


    Do While Not rsCF.EOF
    Values(i) = (rsCF("TotalIncome").Value - rsCF("TotalExpenses").Value)
    rsCF.MoveNext
    i = i + 1


    Loop


    RetRate = XLIrrCalc(Values())
    rsResults.Edit
    rsResults("BusPlan_RecIRR").Value = RetRate
    rsResults.Update
    RetRate = 0

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    May I ask who wrote that code?

  3. #3
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,898
    Why using VBA to do an aggregate calc? Why not just an aggregate query? Or an expression in textbox on report?

    What is XLIrrCalc(). Is this a custom function? Post that code as well.

    Post code between CODE tags to retain indentation and code will be more readable.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 41
    Last Post: 05-29-2015, 02:58 PM
  2. Please help with formula
    By JeanZander in forum Database Design
    Replies: 2
    Last Post: 01-07-2013, 04:39 PM
  3. Q: Help with a formula
    By TroxlSha in forum Access
    Replies: 3
    Last Post: 10-12-2012, 08:50 AM
  4. Please help with this formula.
    By vickan240sx in forum Access
    Replies: 3
    Last Post: 09-17-2012, 03:44 PM
  5. Formula
    By hschrunk in forum Access
    Replies: 3
    Last Post: 05-18-2010, 01:40 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums