Skip to main content Skip to complementary content

RangeIRR - script function

RangeIRR() returns the internal rate of return for a series of cash flows represented by the input values.

The internal rate of return is the interest rate received for an investment consisting of payments (negative values) and income (positive values) that occur at regular periods.

This function uses a simplified version of the Newton method for calculating the internal rate of return (IRR).

Syntax:  

RangeIRR(value[, value][, Expression])

Return data type: numeric

Arguments:  

  • value: A single value or a range of values as returned by an inter record function with a third optional parameter. The function needs at least one positive and one negative value to be calculated.
  • Expression: Optional expressions or fields containing the range of data to be measured.

Limitations:  

Text values, NULL values and missing values are disregarded.

Example 1:  

RangeIRR(-70000,12000,15000,18000,21000,26000) returns 0.0866.

Example 2:  

Add the example script to your document and run it. Then add, at least, the fields listed in the results column to a sheet in your document to see the result.

RangeTab3:

LOAD *,

recno() as RangeID,

RangeIRR(Field1,Field2,Field3) as RangeIRR;

LOAD * INLINE [

Field1|Field2|Field3

-10000|5000|6000

-2000|NULL|7000

-8000|'abc'|8000

-1800|11000|9000

-5000|5000|9000

-9000|4000|2000

] (delimiter is '|');

The resulting table shows the returned values of RangeIRR for each of the records in the table:

Example results
RangeID RangeIRR
1 0.0639
2 0.8708
3 -
4 5.8419
5 0.9318
6 -0.2566

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – let us know how we can improve!

Join the Analytics Modernization Program

Remove banner from view

Modernize without compromising your valuable QlikView apps with the Analytics Modernization Program. Click here for more information or reach out: ampquestions@qlik.com