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 VDB function: variable declining balance depreciation API

Declining-balance depreciation between any two points in an asset's life, switching to straight line, as Excel's VDB.

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

VDB(cost, salvage, life, start_period, end_period, [factor], [no_switch]). Periods may be fractional. Unless no_switch is true, depreciation switches to straight line once that is larger than the declining balance.

Formula

declining balance by period, switching to straight line on the remaining book value when larger; partial periods pro rata
  • 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.
start_period required decimal (string) Start of the span, in the unit of life (0 is the start of the asset's life). A ratio of two decimals such as "0.08/12" is accepted. Allowed: >= 0 and <= 10000.
end_period required decimal (string) End of the span. A ratio of two decimals such as "0.08/12" is accepted. Allowed: >= 0 and <= 10000.
factor decimal (string)
default 2
Rate at which the balance declines (2 is double-declining). A ratio of two decimals such as "0.08/12" is accepted. Allowed: > 0 and <= 1000.
no_switch boolean
default False
true: never switch to straight line.
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
vdbdecimal (string)Depreciation between start_period and end_period.

Examples

Microsoft's example: first day

Requestcurl
curl https://api.curatedapi.com/v1/calc/excel/vdb \
  -H "Authorization: Bearer $CURATEDAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "cost": "2400",
    "salvage": "300",
    "life": "3650",
    "start_period": "0",
    "end_period": "1",
    "options": {"decimals": 2}
  }'
200 OKResponse
{
  "calculator": "excel/vdb@1",
  "result": {
    "vdb": "1.32"
  },
  "exactness": {
    "vdb": "rounded"
  },
  "precision": {
    "rounding": "half_even",
    "decimals": 2
  },
  "inputs": {
    "cost": "2400",
    "salvage": "300",
    "life": "3650",
    "start_period": "0",
    "end_period": "1",
    "factor": "2",
    "no_switch": false
  },
  "formula": "declining balance by period, switching to straight line on the remaining book value when larger; partial periods pro rata",
  "references": [
    {
      "title": "Microsoft Excel VDB function",
      "url": "https://support.microsoft.com/en-us/excel/functions/vdb-function"
    }
  ],
  "warnings": []
}

Microsoft's example: months 6 to 18

Requestcurl
curl https://api.curatedapi.com/v1/calc/excel/vdb \
  -H "Authorization: Bearer $CURATEDAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "cost": "2400",
    "salvage": "300",
    "life": "120",
    "start_period": "6",
    "end_period": "18",
    "options": {"decimals": 2}
  }'
200 OKResponse
{
  "calculator": "excel/vdb@1",
  "result": {
    "vdb": "396.31"
  },
  "exactness": {
    "vdb": "rounded"
  },
  "precision": {
    "rounding": "half_even",
    "decimals": 2
  },
  "inputs": {
    "cost": "2400",
    "salvage": "300",
    "life": "120",
    "start_period": "6",
    "end_period": "18",
    "factor": "2",
    "no_switch": false
  },
  "formula": "declining balance by period, switching to straight line on the remaining book value when larger; partial periods pro rata",
  "references": [
    {
      "title": "Microsoft Excel VDB function",
      "url": "https://support.microsoft.com/en-us/excel/functions/vdb-function"
    }
  ],
  "warnings": []
}

Microsoft's example: months 6 to 18 at factor 1.5

Requestcurl
curl https://api.curatedapi.com/v1/calc/excel/vdb \
  -H "Authorization: Bearer $CURATEDAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "cost": "2400",
    "salvage": "300",
    "life": "120",
    "start_period": "6",
    "end_period": "18",
    "factor": "1.5",
    "options": {"decimals": 2}
  }'
200 OKResponse
{
  "calculator": "excel/vdb@1",
  "result": {
    "vdb": "311.81"
  },
  "exactness": {
    "vdb": "rounded"
  },
  "precision": {
    "rounding": "half_even",
    "decimals": 2
  },
  "inputs": {
    "cost": "2400",
    "salvage": "300",
    "life": "120",
    "start_period": "6",
    "end_period": "18",
    "factor": "1.5",
    "no_switch": false
  },
  "formula": "declining balance by period, switching to straight line on the remaining book value when larger; partial periods pro rata",
  "references": [
    {
      "title": "Microsoft Excel VDB function",
      "url": "https://support.microsoft.com/en-us/excel/functions/vdb-function"
    }
  ],
  "warnings": []
}

Microsoft's example: first fiscal year, 150% limit, bought mid-quarter

Requestcurl
curl https://api.curatedapi.com/v1/calc/excel/vdb \
  -H "Authorization: Bearer $CURATEDAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "cost": "2400",
    "salvage": "300",
    "life": "10",
    "start_period": "0",
    "end_period": "0.875",
    "factor": "1.5",
    "options": {"decimals": 2}
  }'
200 OKResponse
{
  "calculator": "excel/vdb@1",
  "result": {
    "vdb": "315.00"
  },
  "exactness": {
    "vdb": "exact"
  },
  "precision": {
    "rounding": "half_even",
    "decimals": 2
  },
  "inputs": {
    "cost": "2400",
    "salvage": "300",
    "life": "10",
    "start_period": "0",
    "end_period": "0.875",
    "factor": "1.5",
    "no_switch": false
  },
  "formula": "declining balance by period, switching to straight line on the remaining book value when larger; partial periods pro rata",
  "references": [
    {
      "title": "Microsoft Excel VDB function",
      "url": "https://support.microsoft.com/en-us/excel/functions/vdb-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.