Products

DDB function

PRO BASIC

The DDB function in Jspreadsheet Formulas Pro is a handy tool that helps you figure out the depreciation of an asset over a given time period using the double-declining balance method. This method accelerates depreciation, allowing for higher depreciation expenses in earlier periods compared to later ones. You can use this function by inputting specific parameters such as the cost of the asset, its expected lifetime, and the period for which you want to calculate the depreciation. The DDB function then provides the depreciated value for that specified period.

Documentation

Calculates the depreciation of an asset for a specified period using the double-declining balance method.

Category

Financial

Syntax

DDB(cost, salvage, life, period, [factor])

Parameter Description
cost The initial cost of the asset.
salvage The value of the asset at the end of its useful life.
life The number of periods over which the asset will be depreciated.
period The period for which you want to calculate the depreciation. Must be greater than or equal to 1 and less than or equal to the life of the asset.
[factor] Optional. The rate at which the balance declines. If omitted, defaults to 2 (double-declining balance). Must be greater than 0

Behavior

The DDB function is used to compute the depreciation of an asset for a specified period using the double-declining balance method. It requires four mandatory arguments—cost, salvage, life, and period and an optional fifth argument factor. Here's how it handles different types of inputs:

  • Numbers: The function expects all its arguments to be numerical. The cost, salvage, life, period, and factor should all be positive numbers.
  • Empty cells: If any of the required arguments are missing or refer to empty cells, the DDB function will return an error.
  • Text: Text inputs are not applicable for the DDB function. If any of the arguments are text, the function will return an error.
  • Booleans: Boolean values are not applicable for the DDB function. If any of the arguments are boolean values, the function will return an error.
  • Errors: If any of the arguments contain error values or refer to cells with error values, the DDB function will propagate the error.

Common Errors

Error Description
#VALUE! Occurs if any of the supplied arguments are non-numeric.
#NUM! Occurs if the supplied period is < 1, if the period is greater than the life of the asset, or if the factor is <= 0.
#DIV/0! Occurs if the life of the asset is zero, causing a division by zero error.

Best practices

  • Always ensure that all the required arguments are provided to avoid errors.
  • Be cautious about the period argument. It should not be less than 1 or greater than the life of the asset.
  • Avoid using non-numeric values as input to the DDB function to prevent #VALUE! errors.
  • It's advisable to always make sure that the factor is greater than 0 to prevent #NUM! errors.

Usage

A few examples using the DDB function.

DDB(10000, 2000, 10, 2) ➝ 1600  
// Depreciation in year 2 of a $10,000 asset with $2,000 salvage over 10 years using default factor (2)

DDB(50000, 5000, 5, 3, 1.5) ➝ 7350  
// Depreciation in year 3 of a $50,000 asset with $5,000 salvage over 5 years using 1.5x declining balance

DDB(15000, 1000, 7, 1, 2) ➝ 4285.71  
// First-year depreciation using standard double-declining balance method

Interactive Spreadsheet Demo

<html>
<script src="https://jspreadsheet.com/v11/jspreadsheet.js"></script>
<script src="https://jsuites.net/v5/jsuites.js"></script>
<link rel="stylesheet" href="https://jsuites.net/v5/jsuites.css" type="text/css" />
<link rel="stylesheet" href="https://jspreadsheet.com/v11/jspreadsheet.css" type="text/css" />

<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Material+Icons" />
<script src="https://cdn.jsdelivr.net/npm/@jspreadsheet/formula-pro/dist/index.min.js"></script>

<div id="spreadsheet"></div>

<script>
// Set your JSS license key (The following key only works for one day)
jspreadsheet.setLicense('YjIxZmY2NTUzMmQ2NzI4YzYwMzFiZDVmNDY3NjI2MGVhNDQ0YjlmMGMxOTM3OTNjNzNjOGQxMzdjNTU5ODVmY2Y2OGFlODVlMGUyNjgyZDFlODRiODU5OTI1NWVhMjY5N2ZmMGM1MjI3NGEwMDc3NWY2MTlhMDczYTBmYTdlNmEsZXlKamJHbGxiblJKWkNJNklpSXNJbTVoYldVaU9pSktjM0J5WldGa2MyaGxaWFFpTENKa1lYUmxJam94TnpVM01EY3pORFF3TENKa2IyMWhhVzRpT2xzaWFuTndjbVZoWkhOb1pXVjBMbU52YlNJc0ltTnZaR1Z6WVc1a1ltOTRMbWx2SWl3aWFuTm9aV3hzTG01bGRDSXNJbU56WWk1aGNIQWlMQ0p6ZEdGamEySnNhWFI2TG1sdklpd2lkMlZpWTI5dWRHRnBibVZ5TG1sdklpd2lkMlZpSWl3aWJHOWpZV3hvYjNOMElsMHNJbkJzWVc0aU9pSXpOQ0lzSW5OamIzQmxJanBiSW5ZM0lpd2lkamdpTENKMk9TSXNJbll4TUNJc0luWXhNU0lzSW1Ob1lYSjBjeUlzSW1admNtMXpJaXdpWm05eWJYVnNZU0lzSW5CaGNuTmxjaUlzSW5KbGJtUmxjaUlzSW1OdmJXMWxiblJ6SWl3aWFXMXdiM0owWlhJaUxDSmlZWElpTENKMllXeHBaR0YwYVc5dWN5SXNJbk5sWVhKamFDSXNJbkJ5YVc1MElpd2ljMmhsWlhSeklpd2lZMnhwWlc1MElpd2ljMlZ5ZG1WeUlpd2ljMmhoY0dWeklpd2labTl5YldGMElsMHNJbVJsYlc4aU9uUnlkV1Y5');

// Set the extensions
jspreadsheet.setExtensions({ formula });

// Create a new spreadsheet
jspreadsheet(document.getElementById('spreadsheet'), {
  worksheets: [{
    data: [
    [
        "Asset Cost",
        "Salvage Value",
        "Useful Life",
        "Period",
        "Year 1 Depreciation",
        "Year 2 Depreciation",
        "Year 3 Depreciation"
    ],
    [
        25000,
        2000,
        8,
        1,
        "=DDB(A2,B2,C2,D2)",
        "=DDB(A2,B2,C2,2)",
        "=DDB(A2,B2,C2,3)"
    ],
    [
        45000,
        5000,
        6,
        2,
        "=DDB(A3,B3,C3,1)",
        "=DDB(A3,B3,C3,D3)",
        "=DDB(A3,B3,C3,3)"
    ],
    [
        80000,
        8000,
        10,
        3,
        "=DDB(A4,B4,C4,1)",
        "=DDB(A4,B4,C4,2)",
        "=DDB(A4,B4,C4,D4)"
    ]
]
  }]
});
</script>
</html>
import React, { useRef } from "react";
import { Spreadsheet, Worksheet, jspreadsheet } from "@jspreadsheet/react";
import formula from "@jspreadsheet/formula-pro";
import "jsuites/dist/jsuites.css";
import "jspreadsheet/dist/jspreadsheet.css";

// Set license
jspreadsheet.setLicense('YjIxZmY2NTUzMmQ2NzI4YzYwMzFiZDVmNDY3NjI2MGVhNDQ0YjlmMGMxOTM3OTNjNzNjOGQxMzdjNTU5ODVmY2Y2OGFlODVlMGUyNjgyZDFlODRiODU5OTI1NWVhMjY5N2ZmMGM1MjI3NGEwMDc3NWY2MTlhMDczYTBmYTdlNmEsZXlKamJHbGxiblJKWkNJNklpSXNJbTVoYldVaU9pSktjM0J5WldGa2MyaGxaWFFpTENKa1lYUmxJam94TnpVM01EY3pORFF3TENKa2IyMWhhVzRpT2xzaWFuTndjbVZoWkhOb1pXVjBMbU52YlNJc0ltTnZaR1Z6WVc1a1ltOTRMbWx2SWl3aWFuTm9aV3hzTG01bGRDSXNJbU56WWk1aGNIQWlMQ0p6ZEdGamEySnNhWFI2TG1sdklpd2lkMlZpWTI5dWRHRnBibVZ5TG1sdklpd2lkMlZpSWl3aWJHOWpZV3hvYjNOMElsMHNJbkJzWVc0aU9pSXpOQ0lzSW5OamIzQmxJanBiSW5ZM0lpd2lkamdpTENKMk9TSXNJbll4TUNJc0luWXhNU0lzSW1Ob1lYSjBjeUlzSW1admNtMXpJaXdpWm05eWJYVnNZU0lzSW5CaGNuTmxjaUlzSW5KbGJtUmxjaUlzSW1OdmJXMWxiblJ6SWl3aWFXMXdiM0owWlhJaUxDSmlZWElpTENKMllXeHBaR0YwYVc5dWN5SXNJbk5sWVhKamFDSXNJbkJ5YVc1MElpd2ljMmhsWlhSeklpd2lZMnhwWlc1MElpd2ljMlZ5ZG1WeUlpd2ljMmhoY0dWeklpd2labTl5YldGMElsMHNJbVJsYlc4aU9uUnlkV1Y5');

// Set the extensions
jspreadsheet.setExtensions({ formula });

export default function App() {
    // Spreadsheet array of worksheets
    const spreadsheet = useRef();

    // Worksheet data
    const data = [
    [
        "Asset Cost",
        "Salvage Value",
        "Useful Life",
        "Period",
        "Year 1 Depreciation",
        "Year 2 Depreciation",
        "Year 3 Depreciation"
    ],
    [
        25000,
        2000,
        8,
        1,
        "=DDB(A2,B2,C2,D2)",
        "=DDB(A2,B2,C2,2)",
        "=DDB(A2,B2,C2,3)"
    ],
    [
        45000,
        5000,
        6,
        2,
        "=DDB(A3,B3,C3,1)",
        "=DDB(A3,B3,C3,D3)",
        "=DDB(A3,B3,C3,3)"
    ],
    [
        80000,
        8000,
        10,
        3,
        "=DDB(A4,B4,C4,1)",
        "=DDB(A4,B4,C4,2)",
        "=DDB(A4,B4,C4,D4)"
    ]
];

    // Render component
    return (
        <Spreadsheet ref={spreadsheet}>
            <Worksheet data={data} />
        </Spreadsheet>
    );
}
<template>
    <Spreadsheet ref="spreadsheet">
        <Worksheet :data="data" />
    </Spreadsheet>
</template>

<script>
import { Spreadsheet, Worksheet, jspreadsheet } from "@jspreadsheet/vue";
import "jsuites/dist/jsuites.css";
import "jspreadsheet/dist/jspreadsheet.css";
import formula from "@jspreadsheet/formula-pro";

// Set license
jspreadsheet.setLicense('YjIxZmY2NTUzMmQ2NzI4YzYwMzFiZDVmNDY3NjI2MGVhNDQ0YjlmMGMxOTM3OTNjNzNjOGQxMzdjNTU5ODVmY2Y2OGFlODVlMGUyNjgyZDFlODRiODU5OTI1NWVhMjY5N2ZmMGM1MjI3NGEwMDc3NWY2MTlhMDczYTBmYTdlNmEsZXlKamJHbGxiblJKWkNJNklpSXNJbTVoYldVaU9pSktjM0J5WldGa2MyaGxaWFFpTENKa1lYUmxJam94TnpVM01EY3pORFF3TENKa2IyMWhhVzRpT2xzaWFuTndjbVZoWkhOb1pXVjBMbU52YlNJc0ltTnZaR1Z6WVc1a1ltOTRMbWx2SWl3aWFuTm9aV3hzTG01bGRDSXNJbU56WWk1aGNIQWlMQ0p6ZEdGamEySnNhWFI2TG1sdklpd2lkMlZpWTI5dWRHRnBibVZ5TG1sdklpd2lkMlZpSWl3aWJHOWpZV3hvYjNOMElsMHNJbkJzWVc0aU9pSXpOQ0lzSW5OamIzQmxJanBiSW5ZM0lpd2lkamdpTENKMk9TSXNJbll4TUNJc0luWXhNU0lzSW1Ob1lYSjBjeUlzSW1admNtMXpJaXdpWm05eWJYVnNZU0lzSW5CaGNuTmxjaUlzSW5KbGJtUmxjaUlzSW1OdmJXMWxiblJ6SWl3aWFXMXdiM0owWlhJaUxDSmlZWElpTENKMllXeHBaR0YwYVc5dWN5SXNJbk5sWVhKamFDSXNJbkJ5YVc1MElpd2ljMmhsWlhSeklpd2lZMnhwWlc1MElpd2ljMlZ5ZG1WeUlpd2ljMmhoY0dWeklpd2labTl5YldGMElsMHNJbVJsYlc4aU9uUnlkV1Y5');

// Set the extensions
jspreadsheet.setExtensions({ formula });

export default {
    components: {
        Spreadsheet,
        Worksheet,
    },
    data() {
        // Worksheet data
        const data = [
    [
        "Asset Cost",
        "Salvage Value",
        "Useful Life",
        "Period",
        "Year 1 Depreciation",
        "Year 2 Depreciation",
        "Year 3 Depreciation"
    ],
    [
        25000,
        2000,
        8,
        1,
        "=DDB(A2,B2,C2,D2)",
        "=DDB(A2,B2,C2,2)",
        "=DDB(A2,B2,C2,3)"
    ],
    [
        45000,
        5000,
        6,
        2,
        "=DDB(A3,B3,C3,1)",
        "=DDB(A3,B3,C3,D3)",
        "=DDB(A3,B3,C3,3)"
    ],
    [
        80000,
        8000,
        10,
        3,
        "=DDB(A4,B4,C4,1)",
        "=DDB(A4,B4,C4,2)",
        "=DDB(A4,B4,C4,D4)"
    ]
]

        return {
            data
        };
    }
}
</script>
import { Component, ViewChild, ElementRef } from "@angular/core";
import jspreadsheet from "jspreadsheet";
import * as formula from "@jspreadsheet/formula-pro";

// Set your JSS license key (The following key only works for one day)
jspreadsheet.setLicense('YjIxZmY2NTUzMmQ2NzI4YzYwMzFiZDVmNDY3NjI2MGVhNDQ0YjlmMGMxOTM3OTNjNzNjOGQxMzdjNTU5ODVmY2Y2OGFlODVlMGUyNjgyZDFlODRiODU5OTI1NWVhMjY5N2ZmMGM1MjI3NGEwMDc3NWY2MTlhMDczYTBmYTdlNmEsZXlKamJHbGxiblJKWkNJNklpSXNJbTVoYldVaU9pSktjM0J5WldGa2MyaGxaWFFpTENKa1lYUmxJam94TnpVM01EY3pORFF3TENKa2IyMWhhVzRpT2xzaWFuTndjbVZoWkhOb1pXVjBMbU52YlNJc0ltTnZaR1Z6WVc1a1ltOTRMbWx2SWl3aWFuTm9aV3hzTG01bGRDSXNJbU56WWk1aGNIQWlMQ0p6ZEdGamEySnNhWFI2TG1sdklpd2lkMlZpWTI5dWRHRnBibVZ5TG1sdklpd2lkMlZpSWl3aWJHOWpZV3hvYjNOMElsMHNJbkJzWVc0aU9pSXpOQ0lzSW5OamIzQmxJanBiSW5ZM0lpd2lkamdpTENKMk9TSXNJbll4TUNJc0luWXhNU0lzSW1Ob1lYSjBjeUlzSW1admNtMXpJaXdpWm05eWJYVnNZU0lzSW5CaGNuTmxjaUlzSW5KbGJtUmxjaUlzSW1OdmJXMWxiblJ6SWl3aWFXMXdiM0owWlhJaUxDSmlZWElpTENKMllXeHBaR0YwYVc5dWN5SXNJbk5sWVhKamFDSXNJbkJ5YVc1MElpd2ljMmhsWlhSeklpd2lZMnhwWlc1MElpd2ljMlZ5ZG1WeUlpd2ljMmhoY0dWeklpd2labTl5YldGMElsMHNJbVJsYlc4aU9uUnlkV1Y5');

// Set the extensions
jspreadsheet.setExtensions({ formula });

@Component({
    standalone: true,
    selector: "app-root",
    template: `<div #spreadsheet></div>`
})
export class AppComponent {
    @ViewChild("spreadsheet") spreadsheet: ElementRef;
    // Worksheets
    worksheets: jspreadsheet.worksheetInstance[];

    // Create a new data grid
    ngAfterViewInit() {
        // Create spreadsheet
        this.worksheets = jspreadsheet(this.spreadsheet.nativeElement, {
            worksheets: [{
                data: [
    [
        "Asset Cost",
        "Salvage Value",
        "Useful Life",
        "Period",
        "Year 1 Depreciation",
        "Year 2 Depreciation",
        "Year 3 Depreciation"
    ],
    [
        25000,
        2000,
        8,
        1,
        "=DDB(A2,B2,C2,D2)",
        "=DDB(A2,B2,C2,2)",
        "=DDB(A2,B2,C2,3)"
    ],
    [
        45000,
        5000,
        6,
        2,
        "=DDB(A3,B3,C3,1)",
        "=DDB(A3,B3,C3,D3)",
        "=DDB(A3,B3,C3,3)"
    ],
    [
        80000,
        8000,
        10,
        3,
        "=DDB(A4,B4,C4,1)",
        "=DDB(A4,B4,C4,2)",
        "=DDB(A4,B4,C4,D4)"
    ]
]
            }]
        });
    }
}