# XIRR function

• 0 replies
• 85 views

Userlevel 1 • Julien • Community Manager
• 2 replies

## Description

Calculates the internal rate of return of an investment based on future cashflows on specific dates for a given time. The internal rate of return is the rate for which the NPV (net present value) would be 0.

## Syntax

`XIRR(Payment Metric [, Guess] [, Compute All Cells] [, Ranking Dimension] [, Days Used])`

Argument Type Dimensions Description

Payment Metric

(required)

Number or Integer Ranking Dimension This represents the cashflow of the investment. Cashflow can be positive if there is income or negative if payments are needed.

Guess

(optional)

Number or Integer No Dimension This number represents a value close to what you expect your IRR to be. It cannot be below -1 and should rarely be above 100. If not filled, it is by default set at 0.1.

Compute All Cells

(optional)

boolean No Dimension

Defines if the computation should be done on all Ranking Dimension’s items.

If TRUE, starts at the first non-empty Ranking Dimension item until the last non empty.

If FALSE, compute only on the first non-empty item of Ranking Dimension.

By default, set to FALSE.

Ranking Dimension

(optional)

Dimension (any kind)

Required when Payment Metric is defined on multiple dimensions.

Defines the dimension used to perform the calculation on.

Days Used

(optional)

Date Time Dimension

Required when Ranking Dimension is not a Time Dimension generated by Pigment.

Defines the date property that provides the specific dates of the future cashflows.

## Return type

Type Dimensions
Number No Dimension, or subset of Payment Metric’s Dimensions

If Compute All Cells is `FALSE`, will return for the first item of Ranking Dimension for which Payment Metric was not empty the rate for which the NPV of all future payments would be equal to 0.

If Compute All Cells is `TRUE`, will return for all items of Ranking Dimension the rate for which the NPV of all future payments would be equal to 0.

The formula only considers the numeric values, and if there are blanks or text values, these would be ignored.

Pigment uses the Newton-Raphson method to find the IRR and uses the guess as the first point. A result is considered as found once the method has found an IRR for which the NPV is equal to 0 with a 0.00001 percent accuracy.

If after 200 iterations, no result is found, the system will return a blank value.

Cashflows need to be of different signs in order to find a possible result, i.e. you will get a blank result if all values are positive or negative.

## Examples

Click on image to enlarge.

Formula Result Description

`XIRR('Payment Metric', 0.5, FALSE, 'Fiscal Year', 'Fiscal Year'.Date)`

Click on image to enlarge.

This example uses a simple `Payment Metric` defined on a Ranking Dimension named Fiscal Years. The function returns the value for FY 23, as this is the first year of the Ranking Dimension and Compute All Cells is set to `FALSE`. However, you could also use this formula in a Metric without dimensions.

For Days Used, we use `Fiscal Year'.Date` payment date that is a property on the Ranking Dimension , `Fiscal Year`.

Here the Guess has been set to `0.5` but it could reference another single integer or number.

`XIRR('Payment Metric', 0.5, TRUE, 'Fiscal Year', 'Fiscal Year'.Date)`

Click on image to enlarge.

This example is the same as above but sets the Compute All Cells to `TRUE`. This will compute XIRR for each item of the Ranking Dimension, in this case for each year in the `Fiscal Year` dimension.This example is assuming each year is the ‘start’ of a new XIRR computation.

`XIRR('Payment Per Country', 0.5, FALSE, 'Fiscal Year', 'Fiscal Year'.Date)`

Click on image to enlarge.

This example uses a multi-dimensional Payment Metric named `Payment Per Country` and defined on two dimensions: `Fiscal Year` and `Country`.

Excel: IRR, XIRR

Related articles:

IRR