SLN

Returns a Double specifying the straight-line depreciation of an asset for a single period.

Syntax: SLN( cost, salvage, life )

cost
required Double specifying initial cost of the asset.
salvage
required Double specifying value of the asset at the end of its useful life.
life
required Double specifying length of the useful life of the asset.

The depreciation period must be expressed in the same unit as the life argument.

Common Errors

Error When
-2147467259 (&H80004005), Unspecified error life is 0
94 (&H5E), Invalid use of Null cost, salvage or life is Null

Note BETA 1034

When life is 0, VB6 and 64-bit VBA raise error 5 (&H5), Invalid procedure call or argument, instead.

Note BETA 1034

When the result is beyond the range of a Double (twinBASIC returns infinity), 64-bit VBA raises error 6 (&H6), Overflow; twinBASIC raises none.

Example

This example uses the SLN function to return the straight-line depreciation of an asset for a single period given the asset’s initial cost (InitCost), the salvage value at the end of the asset’s useful life (SalvageVal), and the total life of the asset in years (LifeTime).

Dim Fmt, InitCost, SalvageVal, MonthLife, LifeTime, PDepr
Const YEARMONTHS = 12    ' Number of months in a year.
Fmt = "###,##0.00"    ' Define money format.
InitCost = InputBox("What's the initial cost of the asset?")
SalvageVal = InputBox("What's the asset's value at the end of its useful life?")
MonthLife = InputBox("What's the asset's useful life in months?")
Do While MonthLife < YEARMONTHS    ' Ensure period is >= 1 year.
    MsgBox "Asset life must be a year or more."
    MonthLife = InputBox("What's the asset's useful life in months?")
Loop
LifeTime = MonthLife / YEARMONTHS    ' Convert months to years.
If LifeTime <> Int(MonthLife / YEARMONTHS) Then
    LifeTime = Int(LifeTime + 1)    ' Round up to nearest year.
End If
PDepr = SLN(InitCost, SalvageVal, LifeTime)
MsgBox "The depreciation is " & Format(PDepr, Fmt) & " per year."

See Also