DURATION function

exc005

New Member
Joined
Jul 4, 2017
Messages
1
Hi all

DURATION function : Returns the Macauley duration for an assumed par value of $100. Duration is defined as the weighted average of the present value of the cash flows and is used as a measure of a bond price's response to changes in yield.

DURATION(settlement, maturity, coupon, yld, frequency, [basis])

it is usually calculated by excel ; for example

B7=DURATION(B1,B2,B3,B4,B5,B6)

526223d1499192962-duration-function-iepum.png



but what i am trying to do , is to customize Duration function with vba editor

526226d1499196153-duration-function-2017-07-04_202126.png


i think Excel uses this formula as explained in Wikipedia for calculation Macauley duration.

526227d1499196377-duration-function-ol1om.png


:crash: the problem is i find difficulty to write this function in vba to calculate Duration like Excel
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).

Forum statistics

Threads
1,223,902
Messages
6,175,278
Members
452,629
Latest member
SahilPolekar

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top