SLN 函數

套用到
Microsoft 365 Access Access 2024 Access 2021 Access 2019 Access 2016

回傳一個雙重值,指定資產在單一期間的直線折舊。

語法

SLN (成本、打撈、生命)

SLN 函數具有以下參數:

引數 描述
成本 必要。 雙重 指定資產的初始成本。
打撈 必要。 雙重 指定資產在其使用壽命結束時的價值。
生平 必要。 雙重 指定資產的使用壽命長度。

註解

折舊期間必須與生命週期論點相同的單位表示。 所有參數必須為正數。

查詢範例

運算式 結果
選擇 SLN ([貸款金額],[貸款金額]*0.1,20) 作為 Expr1 來自 FinancialSample; 返還價值為「貸款金額」的資產折舊,殘值為10% (「貸款金額」乘以0.1) ,且考慮資產的有效年限為20年。
選擇SLN ([貸款金額],0,20) 作為SL。來自FinancialSample的折舊; 返還資產的折舊,價值為「貸款金額」,殘值為0美元,且資產的使用年限為20年。 結果顯示在 SLDepreciation 欄位。

VBA 範例

注意

下列範例示範如何在 Visual Basic for Applications (VBA) 模組中使用此函數。 如需使用 VBA 的詳細資訊,請在 [搜尋] 旁的下拉式清單中選取 [開發人員參考],並在 [搜尋] 方塊中輸入一個或多個字詞。

此範例使用 SLN 函數,根據資產初始成本 () 、資產使用壽命結束時的殘值) InitCost (SalvageVal ,以及資產總生命週期( () 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."