Using XIRR In VBA?

Jun 9, 2011

I cannot seem to make my code work. I've used application.worksheetfunction.xirr successfully referring to actual spreadsheet cells, e.g.

VB:
VarIRR = Application.WorksheetFunction.Xirr(Range(Cells(5, 3), Cells(Icount, 3)), Range(Cells(5, 2), Cells(Icount, 2)))

but now, when I'm trying to use arrays instead, it's giving me and error "1004 - Unable to get the XIRR property of the worksheetfunction class."

VB:
tempIRR = Application.WorksheetFunction.Xirr(valueArray, dateArray, 0.01)

I do have the analysis toolpak installed, I've ensured that the date range is seen as date, not text. Number of elements in the value array equals the number of elements in the date array, and I do have negative and positive values..

the full sub of what I'm trying to do:

VB:
Sub CalculateIRR()
Dim i As Integer
Dim j As Integer

[Code]....

View 9 Replies


ADVERTISEMENT

Xirr Function In VBA

Mar 7, 2007

I am having trouble with the Xirr function in VBA. The problem revolves around the sensitivity of the solution to the 'initial guess'. specifically the boundary between a +ve and -ve guess. i.e. if the xirr is large and -ve a positive guess will always give me a solution very close to zero, as opposed to the more meaningfull solution say -65%.

To get around this i have constructed the UDF below, which is used as part of a sub, however for some investments i get the type mismatch error (error(13)) even though the arrays are of identical size and the data should be uniform as it is a dump from a database.

Has anyone encountered this 'type mismatch' problem with xirr before? is there a way to access the vba code for xirr so that it can be altered?

Function fkxirr(arrVals, arrDates)

Dim r As Double
Dim Step As Double
Dim tolerance As Double
Dim xir As Double

r = 10
tolerance = 0.000001
Step = 0.1

View 8 Replies View Related

Automating Xirr

May 7, 2007

I have a very peculiar problem. Each month I have a set of financial products for which I calculate the IRR values using XIRR, as the cash flows are uneven. Imagine this, Product names in ColumnA, the cashflow dates in B, and the cash flows with transaction types in ColumnC and finall D has amounts in negetive and positive. Each month I add new cashflows for each product as rows.

Manually I scroll down to select the range for XIRR (both date and amount)
Offlate this work has gone really high in terms of values, and manually cacluating XIRR takes hell lot of time for all the products (currently 80 odd)

View 9 Replies View Related

XIRR With Moveable Start Dates?

Jun 5, 2014

I am trying to automate calculation of IRR for a range of scenarios.

I have a bunch of problems with this:

1. On a full cycle basis, the project start dates are not equal which means that in certain scenarios I get 0% return as the first cash flow is zero.

2. On a point forward basis, negative cash flows may start after T0 (i.e. now)

I have circumvented this on NPV basis by using a Sumproduct of individual cashflows, discount factors (full cycle cashflows are inflated to T0) and a proportional period factor (where T

View 1 Replies View Related

Calculate Xirr If A Column Meets A Certain Criteria

Aug 12, 2008

Is it posssible to use the xirr function with conditions. For example, an array formula that will only calculate xirr if a column meets a certain criteria or if the dates are within a range?

View 9 Replies View Related

IRR- XIRR - Annualized Rate Of Return On Single Transaction

Dec 2, 2009

Here's my problem:
A) This is regarding a real estate transaction.

B) Assume the funds to acquire the investment total $60,000.

C) Assume the purchase date is 1/1/10.

D) Assume the sales price (including costs) would total $76,000.

E) Assume the sales closing date is 4/1/10.

F) What formula function would allow me to show the Annualized Rate of Return on this transaction?

I Know this is something I should have been able to figure out -- but when I use the XIRR function, I end up with a figure of 167% -- and common sense indicates that's just not correct....?

What I need to do is just find a way to show either the IRR or the Annualized Rate of Return for investment consideration purposes. Is it possible to do this based on one single transaction that occurs in a fraction of a year?

View 9 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved