Sunday, May 16, 2021

Sln function

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

Syntax

SLN( cost, salvage, life )

The SLN function has these arguments:

Argument

Description

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.

Remarks

The depreciation period must be expressed in the same unit as the lifeargument. All arguments must be positive numbers.

Query examples

Expression

Results

SELECT SLN([LoanAmount],[LoanAmount]*.1,20) AS Expr1 FROM FinancialSample;

Returns the depreciation for an asset valued as "LoanAmount", with a salvage value of 10%("LoanAmount" multiplied by 0.1), considering the useful life of the asset to be 20 years.

SELECT SLN([LoanAmount],0,20) AS SLDepreciation FROM FinancialSample;

Returns the depreciation for an asset valued as "LoanAmount", with a salvage value of $0, considering the useful life of the asset to be 20 years. The results are displayed in the column SLDepreciation.

VBA example

Note: Examples that follow demonstrate the use of this function in a Visual Basic for Applications (VBA) module. For more information about working with VBA, select Developer Reference in the drop-down list next to Search and enter one or more terms in the search box.

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
Dim 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?")
' Ensure period is >= 1 year.
Do While MonthLife < YEARMONTHS
MsgBox "Asset life must be a year or more."
MonthLife = InputBox("What's the asset's " & _
"useful life in months?")
Loop
' Convert months to years.
LifeTime = MonthLife / YEARMONTHS
If LifeTime <> Int(MonthLife / YEARMONTHS) Then
' Round up to nearest year.
LifeTime = Int(LifeTime + 1)
End If
PDepr = SLN(InitCost, SalvageVal, LifeTime)
MsgBox "The depreciation is " & _
Format(PDepr, Fmt) & " per year."

No comments:

Post a Comment