DDB 函數

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

傳回 Double,使用雙餘額遞減法或您指定的其他方法,指定資產在特定時段內的折舊。

語法

DDB (成本、報廢、壽命、期間* [, 因數] )

DDB 函數語法具有下列引數:

引數 描述
成本 必要。 Double 指定資產的初始成本。
搶救 必要。 Double 指定資產在其使用壽命結束時的價值。
生活 必要。 Double 指定資產的使用壽命長度。
期間 必要。 Double 指定計算資產折舊的期間。
因數 可省略。 指定餘額下降率的變體。 如果省略,則假設 2 (雙遞減法) 。

    

註解

倍率遞減法使用加速比率計算折舊。 折舊數額在首期最高,然後在後繼期間依次遞減。

生命句點引數必須以相同的單位表示。 例如,如果 生命 以月為單位,則 期限 也必須以月為單位給出。 所有引數都必須是正數。

DDB 函數使用下列公式來計算指定期間的折舊:

折舊/ 期間 = ( (成本報廢) * 係數) / 壽命

範例

注意

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

此範例使用 DDB 函數,在指定期間內傳回資產在指定期間內的折舊,假設有初始成本 () InitCost 、資產使用年限結束時的殘值 () SalvageVal 、資產的總使用年限 (以年 (LifeTime) 年為單位) 以及以) 計算折舊的年 (Depr 期間。

Dim Fmt, InitCost, SalvageVal, MonthLife, LifeTime, DepYear, Depr
Const YRMOS = 12    ' Number of months in a year.
Fmt = "###,##0.00"
InitCost = InputBox("What's the initial cost of the asset?")
SalvageVal = InputBox("Enter the asset's value at end of its life.")
MonthLife = InputBox("What's the asset's useful life in months?")
Do While MonthLife < YRMOS    ' 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 / YRMOS    ' Convert months to years.
If LifeTime <> Int(MonthLife / YRMOS) Then
    LifeTime = Int(LifeTime + 1)    ' Round up to nearest year.
End If 
DepYear = CInt(InputBox("Enter year for depreciation calculation."))
Do While DepYear < 1 Or DepYear > LifeTime
    MsgBox "You must enter at least 1 but not more than " & LifeTime
    DepYear = InputBox("Enter year for depreciation calculation.")
Loop
Depr = DDB(InitCost, SalvageVal, LifeTime, DepYear)
MsgBox "The depreciation for year " & DepYear & " is " & _
Format(Depr, Fmt) & "."