CF_GET function

Actuarial Excel Addin

The CF_GET function extracts one value or one contiguous sub-vector from a yearly cash-flow vector.

* : Required parameter

Parameters
Default
Description
cf *
--
Yearly cash-flow vector where year 1 maps to the first element.
year *
--
Start year index to extract. Must be an integer between 1 and 120.
year_to
year
Optional end year index. Must be an integer between 1 and 120, and greater than or equal to year.

Example
Result
CF_Get(A2#, 1)
Returns the first yearly cash-flow value.
CF_Get(A2#, 3, 8)
Returns a spilled vector containing years 3 to 8, inclusive.

Where:
A2#
Is a spilled vector.

Notes
Description
Indexing
The function uses 1-based cash-flow years, not 0-based array indices.
Return shape
When year_to is omitted or equal to year, the function returns one value. Otherwise, it returns a spilled vector.
Beyond input length
For a single year, if year is greater than the vector length, the function returns 0. For a range, missing tail years are returned as zeros.
Validation
Returns a numeric error when year or year_to is outside 1..120, non-integer, or when year_to < year. Returns a value error if cf cannot be parsed as a non-empty cash-flow vector.