Financial.SLN(Double, Double, Double) 方法

定義

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

C#
public static double SLN (double Cost, double Salvage, double Life);

參數

Cost
Double

必要。 資產的初始成本。

Salvage
Double

必要。 資產在可用年限末期的價值。

Life
Double

必要。 資產的可用年限長度。

傳回

資產在單一期間內的直線折舊。

例外狀況

Life = 0。

範例

此範例會 SLN 使用 函式傳回資產的直線折舊,因為資產的初始成本 () InitCost 、資產 (SalvageVal) 的結尾的擷取值,以及 () 年 LifeTime 資產的總存留期。

VB
Dim InitCost, SalvageVal, LifeTime, DepYear As Double
Dim Fmt As String = "###,##0.00"

InitCost = CDbl(InputBox("What's the initial cost of the asset?"))
SalvageVal = CDbl(InputBox("Enter the asset's value at end of its life."))
LifeTime = CDbl(InputBox("What's the asset's useful life in years?"))

' Use the SLN function to calculate the deprecation per year.
Dim SlnDepr As Double = SLN(InitCost, SalvageVal, LifeTime)
Dim msg As String = "The depreciation per year: " & Format(SlnDepr, Fmt)
msg &= vbCrLf & "Year" & vbTab & "Linear" & vbTab & "Doubling" & vbCrLf

' Use the SYD and DDB functions to calculate the deprecation for each year.
For DepYear = 1 To LifeTime
    msg &= DepYear & vbTab & 
        Format(SYD(InitCost, SalvageVal, LifeTime, DepYear), Fmt) & vbTab & 
        Format(DDB(InitCost, SalvageVal, LifeTime, DepYear), Fmt) & vbCrLf
Next
MsgBox(msg)

備註

折舊期間必須以 Life 與 自變數相同的單位表示。 所有自變數都必須是正數。

適用於

產品 版本
.NET Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

另請參閱