Excel DB function: fixed-declining balance depreciation API
Fixed-declining balance depreciation for one period, as Excel's DB, including its three-decimal rate and part-year first and last periods.
POST https://api.curatedapi.com/v1/calc/excel/db
- Version 1
- MCP tool
calc_excel_db - Try it in the browser
DB(cost, salvage, life, period, [month]). The rate 1 − (salvage/cost)^(1/life) is rounded to three decimals, as Excel does. The first period covers month months; when month < 12 there is a final period life + 1 for the remainder.
Formula
period 1: cost·rate·month/12; then (cost − prior depreciation)·rate; last: (cost − prior)·rate·(12 − month)/12
- 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).
| Input | Type | Description |
|---|---|---|
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 |
integer | Life in years (whole years). Allowed: >= 1 and <= 1200. |
period required |
integer | The period (year) to calculate, from 1. Allowed: >= 1 and <= 1201. |
month |
integer default 12 |
Months in the first year (default 12). Allowed: >= 1 and <= 12. |
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.
| Result | Type | Description |
|---|---|---|
db | decimal (string) | Depreciation in that period. |
rate | decimal (string) | The rounded rate Excel uses. |
Examples
Microsoft's example: year 1, 7 months
curl https://api.curatedapi.com/v1/calc/excel/db \
-H "Authorization: Bearer $CURATEDAPI_KEY" \
-H "Content-Type: application/json" \
-d '{
"cost": "1000000",
"salvage": "100000",
"life": 6,
"period": 1,
"month": 7,
"options": {"decimals": 2}
}'
{
"calculator": "excel/db@1",
"result": {
"db": "186083.33",
"rate": "0.32"
},
"exactness": {
"db": "rounded",
"rate": "rounded"
},
"precision": {
"rounding": "half_even",
"decimals": 2
},
"inputs": {
"cost": "1000000",
"salvage": "100000",
"life": 6,
"period": 1,
"month": 7
},
"formula": "period 1: cost·rate·month/12; then (cost − prior depreciation)·rate; last: (cost − prior)·rate·(12 − month)/12",
"references": [
{
"title": "Microsoft Excel DB function",
"url": "https://support.microsoft.com/en-us/excel/functions/db-function"
}
],
"warnings": []
}
Microsoft's example: year 7, 5 months
curl https://api.curatedapi.com/v1/calc/excel/db \
-H "Authorization: Bearer $CURATEDAPI_KEY" \
-H "Content-Type: application/json" \
-d '{
"cost": "1000000",
"salvage": "100000",
"life": 6,
"period": 7,
"month": 7,
"options": {"decimals": 2}
}'
{
"calculator": "excel/db@1",
"result": {
"db": "15845.10",
"rate": "0.32"
},
"exactness": {
"db": "rounded",
"rate": "rounded"
},
"precision": {
"rounding": "half_even",
"decimals": 2
},
"inputs": {
"cost": "1000000",
"salvage": "100000",
"life": 6,
"period": 7,
"month": 7
},
"formula": "period 1: cost·rate·month/12; then (cost − prior depreciation)·rate; last: (cost − prior)·rate·(12 − month)/12",
"references": [
{
"title": "Microsoft Excel DB function",
"url": "https://support.microsoft.com/en-us/excel/functions/db-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.