Calculate asset depreciation using the Double Declining Balance method
Depreciation means a reduction in the value of an asset with the passage of time. It is computed based on the initial purchase price or initial cost, number of years where depreciation is calculated, salvage value at the end of the depreciation period, and the asset's life span.
Depreciation is an important element in the management of a company's assets. With proper and accurate calculation of depreciation, a company can benefit from the tax advantage.
The Double Declining Balance (DDB) method is an accelerated depreciation method that applies twice the straight-line depreciation rate to the asset's book value at the beginning of each period. This results in higher depreciation expenses in the early years of an asset's life.
Formula: Depreciation Expense = (2 / Useful Life) × Book Value at Beginning of Year
| Year | Beginning Value | Depreciation Rate | Depreciation Expense | Ending Value |
|---|
This is the Visual Basic 6 implementation of the depreciation calculator using the DDB function:
Private Sub Command1_Click()
Dim Int_Cost, Sal_Value, Asset_Life, Deperiod, Depre_Amt As Double
Int_Cost = Val(Txt_Cost.Text)
Sal_Value = Val(Txt_Salvage.Text)
Asset_Life = Val(Txt_Life.Text)
Deperiod = Val(Txt_Period.Text)
Depre_Amt = DDB(Int_Cost, Sal_Value, Asset_Life, Deperiod)
Lbl_Dpre.Caption = Format(Depre_Amt, "$###,###,000.00")
End Sub
The DDB function in Visual Basic 6 calculates depreciation for a specific period using the double-declining balance method.
This is the VB.NET implementation of the depreciation calculator:
Public Function CalculateDDB(cost As Double, salvage As Double, life As Integer, period As Integer) As Double
If period < 1 Or period > life Then
Return 0
End If
Dim depreciation As Double = 0
Dim currentValue As Double = cost
' Calculate depreciation for each year until the requested period
For year As Integer = 1 To period
Dim rate As Double = 2 / life
Dim yearDepreciation As Double = currentValue * rate
' In the last period, we might need to adjust to not go below salvage
If currentValue - yearDepreciation < salvage Then
yearDepreciation = currentValue - salvage
End If
' For the requested period, return the calculated depreciation
If year = period Then
depreciation = yearDepreciation
End If
currentValue -= yearDepreciation
Next
Return depreciation
End Function
Private Sub btnCalculate_Click(sender As Object, e As EventArgs) Handles btnCalculate.Click
Dim initialCost As Double = CDbl(txtInitialCost.Text)
Dim salvageValue As Double = CDbl(txtSalvageValue.Text)
Dim assetLife As Integer = CInt(txtAssetLife.Text)
Dim period As Integer = CInt(txtPeriod.Text)
Dim depreciation = CalculateDDB(initialCost, salvageValue, assetLife, period)
lblResult.Text = depreciation.ToString("C")
End Sub
This VB.NET code calculates depreciation using the double-declining balance method and includes validation to ensure the book value doesn't drop below the salvage value.
This JavaScript implementation powers the interactive calculator on this page:
function calculateDepreciation() {
// Get input values
const cost = parseFloat(document.getElementById('initialCost').value) || 0;
const salvage = parseFloat(document.getElementById('salvageValue').value) || 0;
const life = parseInt(document.getElementById('assetLife').value) || 1;
const period = parseInt(document.getElementById('depreciationPeriod').value) || 1;
// Validate inputs
if (cost <= 0 || life <= 0 || period <= 0 || period > life) {
alert('Please enter valid values');
return;
}
// Calculate depreciation using DDB method
let currentValue = cost;
let depreciation = 0;
let scheduleHTML = '';
for (let year = 1; year <= life; year++) {
const rate = 2 / life;
let yearDepreciation = currentValue * rate;
// Adjust depreciation if it would take value below salvage
if (currentValue - yearDepreciation < salvage) {
yearDepreciation = currentValue - salvage;
}
// Capture depreciation for the requested period
if (year === period) {
depreciation = yearDepreciation;
}
// Add to schedule
scheduleHTML += `
<tr>
<td>${year}</td>
<td>${currentValue.toFixed(2)}</td>
<td>${(rate * 100).toFixed(0)}%</td>
<td>${yearDepreciation.toFixed(2)}</td>
<td>${(currentValue - yearDepreciation).toFixed(2)}</td>
</tr>
`;
// Update current value for next year
currentValue -= yearDepreciation;
}
// Display results
document.getElementById('depreciationAmount').textContent = '$' + depreciation.toFixed(2);
document.getElementById('periodDisplay').textContent = 'Year ' + period;
document.getElementById('bookValueDisplay').textContent = 'Book Value: $' + (cost - depreciation).toFixed(2);
document.getElementById('scheduleBody').innerHTML = scheduleHTML;
}
Copyright©2008-2023 Dr. Liew Voon Kiong. All rights reserved
Contact | Privacy Policy | Terms of Use
Last update: