Return the depreciation for each accounting period. <span align="right" style="background-color:99FF99"><strong>Excel: AMORLINC</strong></span>

View versions (1)

Interface

#include <codecogs/finance/accounting/deprecprorated.h>

using namespace Finance::Accounting;

This function calculates the depreciation of an asset for each accounting period. It is provided for use with the French accounting system. This function is equivalent to the Microsoft Excel function AMORLINC.

Example 1

#include <stdio.h>

#include <codecogs/units/date/date.h>
#include <codecogs/finance/accounting/deprecprorated.h>

int main(void)
{
  int datePur=Units::Date::date(1998, 8, 19);
  int dateFir=Units::Date::date(1998, 12, 31);
  double deprec;
  deprec=Finance::Accounting::deprecProRated(2400,
                                         datePur,
                                         dateFir,
                                         300,
                                         1,
                                         0.15,
                                         Finance::Banking::yb_Act);
  int y, m, d;
  
  printf("Consider an asset with the following terms:\n\n");
  printf("cost 2400, salvage 300, 1st period, rate 15%%\n");
 
  Units::Date::dateYMD(datePur, y, m, d);
  printf("purchase date %i/%i/%i, ", y, m, d);

  Units::Date::dateYMD(dateFir, y, m, d);
  printf("end of first period %i/%i/%i, ", y, m, d);
  
  printf("depreciation=%f\n", deprec);
  return 0;
}

Output

Consider an asset with the following terms:

cost 2400, salvage 300, 1st period, rate 15%
purchase date 1998/8/19, end of first period 1998/12/31, depreciation=360.0

Parameters

valCost
The cost of the asset.
datePu
The date of purchase of the asset.
dateFi
The date of the end of the first period.
valSalv
The salvage value at the end of the life of the asset.
period
The period.
rate
The rate of depreciation (e.g. 15% depreciation rate is
Blank

0.15).

Parameters

basis
The day count basis to use, one of:
Blank

\copydoc YearBasis

Returns

The depreciation for each accounting period.

In Excel, AMORLIC does not allow a YearBasis of yb_Act360. We can see few reasons for this restriction, so it is provided here. Otherwise this function should replicate Excel in every way.

GPL Licence — free for non commercial use. See Licence details.