DURATION Formula in Excel: How to Calculate Time Differences
In this article
The DURATION formula in Excel calculates the Macaulay duration of a security that pays periodic interest, such as a bond. It helps investors understand how sensitive a bond’s price is to changes in interest rates. To use it, you need accurate inputs: settlement date, maturity date, coupon rate, yield, frequency, and optional basis. This formula does not compute simple time differences between two dates—that’s done with basic subtraction. DURATION is a financial function for bond analysis, not general time tracking.
What You'll Need
- Microsoft Excel 2010 or later (Windows or Mac)
- Settlement date of the bond (when the buyer pays)
- Maturity date of the bond (when the principal is repaid)
- Annual coupon rate as a decimal (e.g., 5% = 0.05)
- Annual yield to maturity as a decimal (e.g., 4.5% = 0.045)
- Number of coupon payments per year (1 = annual, 2 = semiannual, 4 = quarterly)
- Optional: Day count basis (0 to 4; default is 0 for US (NASD) 30/360)
Step-by-Step
- Open a new or existing Excel workbook and ensure the cells containing your bond data are clearly labeled. For example, put the settlement date in cell B2, maturity date in B3, coupon rate in B4, yield in B5, frequency in B6, and basis in B7.
- Enter the settlement date in B2 as a valid Excel date (e.g., 1/15/2025). Excel stores dates as serial numbers, so avoid text entries like "January 15, 2025".
- Enter the maturity date in B3 as a valid Excel date (e.g., 1/15/2035). This date must be later than the settlement date.
- In cell B4, enter the annual coupon rate as a decimal (e.g., 0.06 for 6%). Do not use the % symbol unless Excel automatically converts it.
- In cell B5, enter the annual yield to maturity as a decimal (e.g., 0.055 for 5.5%). This should reflect the market rate at which the bond is trading.
- In cell B6, enter the payment frequency: 1 for annual, 2 for semiannual, or 4 for quarterly. Never use 0 or a number higher than 4.
- In cell B7, optionally enter the day count basis: 0 for US (NASD) 30/360 (default), 1 for actual/actual, 2 for actual/360, 3 for actual/365, or 4 for European 30/360. If unsure, leave it blank to use the default.
- In the cell where you want the duration result (e.g., B8), type: =DURATION(B2,B3,B4,B5,B6,B7)
- Press Enter. Excel returns the Macaulay duration as a decimal number. For example, 7.82 means the bond’s price will change approximately 7.82% for a 1% change in yield.
- Format the result as a number with two decimal places by selecting the cell, right-clicking, choosing Format Cells, then selecting Number and setting Decimal places to 2.
Common Mistakes
- Using text instead of actual dates in the settlement or maturity fields—Excel returns #VALUE! if dates aren’t recognized.
- Entering the coupon rate or yield as percentages (e.g., 6%) without converting to decimals (0.06). Excel interprets 6% as 6, not 0.06, causing massive errors.
- Using an invalid frequency value (e.g., 3 or 5). Only 1, 2, and 4 are accepted.
- Setting the maturity date before the settlement date. The function requires the bond to be valid in time.
- Leaving the basis field blank when you meant to use actual/actual (basis = 1). Defaulting to 30/360 may skew results for long-term bonds.
- Confusing DURATION with DURATION.D or other functions. There is no DURATION.D in Excel; only DURATION exists.
Tips
- Use DATE(2025,1,15) instead of typing dates directly if you’re unsure of regional date formats. This avoids ambiguity.
- Test your inputs using a simple bond: set settlement to 1/1/2025, maturity to 1/1/2030, coupon 5%, yield 5%, frequency 2. Duration should be very close to 4.5 years.
- Combine DURATION with MDURATION if you need modified duration for more precise price sensitivity calculations.
- Always validate your yield input—it must reflect the current market price of the bond, not the coupon rate.
- Use cell references in your formula, not hardcoded values. This makes your spreadsheet dynamic and reusable for multiple bonds.
- If calculating duration for multiple bonds, copy the formula down a column after entering the first instance.
Troubleshooting
- If you see #NAME?, Excel doesn’t recognize DURATION. This usually means the Analysis ToolPak add-in is not loaded. Go to File > Options > Add-Ins. At the bottom, select Excel Add-ins from the Manage dropdown and click Go. Check "Analysis ToolPak" and click OK. Restart Excel if needed.
- If you see #NUM!, check that: (1) settlement date is earlier than maturity date, (2) coupon rate is ≥ 0, (3) yield is ≥ 0, (4) frequency is 1, 2, or 4, and (5) basis is 0–4. Any violation returns this error.
- If the result seems too high or low, verify that coupon and yield are in decimal form. A coupon of 6% entered as 6 (instead of 0.06) will cause a duration of over 100 years.
- If dates are returning serial numbers instead of formatted dates, select the cell and change the format to Short Date or Long Date under Home > Number Format.
- If you’re on a Mac and the function doesn’t work, ensure you’re using Excel for Mac 2016 or later. Older versions may not support this function.
- If the formula works but the result is 0, check that your yield is not zero. A zero yield causes undefined behavior in the duration formula.