curatedapi
Browse the docs

Guides

Finance

Excel functions

Late payments

E-invoices

Accounting

Number checks

VAT and GST

Billing and pricing

Money and currencies

Dates and time

Math

Unit conversion

Everyday

Health

Excel SLN function: straight-line depreciation API

Straight-line depreciation for one period, as Excel's SLN.

POST https://api.curatedapi.com/v1/calc/excel/sln

SLN(cost, salvage, life) = (cost − salvage) / life.

Formula

(cost − salvage) / life
  • Arguments are named and ordered as in Excel. Excel computes in binary floating point; this API computes the exact value of the same formula and rounds it once, so it agrees with Excel to the digits Excel can show, and where Excel's own rounding error reaches the 15th digit this answer is the correct one.

Inputs

Send numbers as strings to keep every digit. options sets precision and rounding (see numbers and rounding).

InputTypeDescription
cost required decimal (string) Initial cost of the asset. A ratio of two decimals such as "0.08/12" is accepted. Allowed: >= 0 and <= 1000000000000000.
salvage required decimal (string) Value at the end of its life (can be 0). A ratio of two decimals such as "0.08/12" is accepted. Allowed: >= 0 and <= 1000000000000000.
life required decimal (string) Number of periods over which the asset is depreciated. A ratio of two decimals such as "0.08/12" is accepted. Allowed: > 0 and <= 10000.
options.rounding half_even | half_up | half_down | up | down | ceiling | floor Rounding mode applied once to each result. Default half_even.
options.decimals integer Round results to this many digits after the decimal point.
options.significant_digits integer Round results to this many significant digits.

Result

Under result in the answer, next to exactness, precision, inputs, formula, references and warnings.

ResultTypeDescription
slndecimal (string)Depreciation per period.

Examples

Microsoft's example: $30,000 truck, $7,500 salvage, 10 years

Requestcurl
curl https://api.curatedapi.com/v1/calc/excel/sln \
  -H "Authorization: Bearer $CURATEDAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "cost": "30000",
    "salvage": "7500",
    "life": "10"
  }'
200 OKResponse
{
  "calculator": "excel/sln@1",
  "result": {
    "sln": "2250"
  },
  "exactness": {
    "sln": "exact"
  },
  "precision": {
    "rounding": "half_even",
    "significant_digits": 15
  },
  "inputs": {
    "cost": "30000",
    "salvage": "7500",
    "life": "10"
  },
  "formula": "(cost − salvage) / life",
  "references": [
    {
      "title": "Microsoft Excel SLN function",
      "url": "https://support.microsoft.com/en-us/excel/functions/sln-function"
    }
  ],
  "warnings": []
}

References

Results follow each calculator's documented rules and the sources listed. They are not financial, tax or legal advice. Check that the rules fit your case before you rely on a result. See the terms.

Errors share one format; see errors. Billing, retries and batches work the same for every endpoint.