When calculating the depreciation of an asset, it is common to use an accelerated depreciation calculation, in which the calculated value of an asset is reduced by a larger amount during the first period of its lifetime, and smaller amounts during subsequent periods.
One of the most popular accelerated depreciation methods is the Double DecliningBalance Method, in which the straightline depreciation rate is doubled. A useful example of this is provided on the Wikipedia depreciation page
The Excel DDB function calculates the depreciation of an asset, using the Double Declining Balance Method, or another specified depreciation rate.
The syntax of the function is:
where the arguments are:
cost    The initial cost of the asset. 
salvage    The value of the asset at the end of its useful life. 
life    The number of periods over which the asset is to be depreciated. 
period    The period number for which you want to calculate the depreciation. 
[factor]   
An optional argument that is used to specify the rate of depreciation. If the [factor] argument is omitted from the function, it takes on the default value of 2 (denoting the double declining depreciation method). 
In the example below, the DDB function uses the double declining depreciation method to calculate the yearly depreciation of an asset that costs $10,000 at the start of year 1, and has a salvage value of $1,000 after 5 years.
Formulas:

Results:

Further details and examples of the Excel DDB function are provided on the Microsoft Office website.
If you get an error from the Excel DDB Function, this is likely to be one of the following:
#NUM!   
Occurs if either:

#VALUE!    Occurs if any of the supplied arguments are nonnumeric. 