Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Google Sheets DURATION Function: How to Use It

· 4 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

The DURATION function in Google Sheets calculates the Macaulay duration of a security that pays periodic interest, given its settlement date, maturity date, coupon rate, yield, and payment frequency. It returns a number in years, representing the weighted average time until cash flows are received. To use it, you need the security's details and a basic understanding of the required arguments. This guide walks you through the syntax, step-by-step usage, common pitfalls, and troubleshooting.

What You'll Need

  • A Google account with access to Google Sheets.
  • The security's settlement date (the date you purchase the security).
  • The maturity date (when the security expires).
  • The annual coupon rate (as a decimal or percentage).
  • The annual yield to maturity (as a decimal or percentage).
  • The number of coupon payments per year (1 for annual, 2 for semi-annual, 4 for quarterly).
  • Optional: a day-count basis (0 for US 30/360, 1 for actual/actual, etc.). If omitted, Google Sheets assumes 0.

Step-by-Step

  1. Open Google Sheets and create a new spreadsheet or open an existing one.
  2. Enter your data in separate cells. For example:
    • A1: Settlement date (e.g., 1/1/2025)
    • A2: Maturity date (e.g., 1/1/2030)
    • A3: Coupon rate (e.g., 0.05 for 5%)
    • A4: Yield (e.g., 0.06 for 6%)
    • A5: Frequency (e.g., 2 for semi-annual)
    • A6: Basis (optional, e.g., 0)
  3. Select the cell where you want the duration result to appear.
  4. Type the DURATION formula: =DURATION(A1, A2, A3, A4, A5, A6). If you omit the basis, use =DURATION(A1, A2, A3, A4, A5).
  5. Press Enter. The cell will display the Macaulay duration in years.
  6. Format the result as a number with desired decimal places (e.g., 2 decimals) using the toolbar.
  7. Verify your inputs: Ensure dates are valid, coupon and yield are positive, and frequency is 1, 2, or 4. The function returns an error if inputs are invalid.

Common Mistakes

  • Using incorrect date formats: Google Sheets may interpret dates differently depending on locale. Use unambiguous formats like YYYY-MM-DD or ensure cells are formatted as dates.
  • Entering coupon and yield as percentages instead of decimals: For 5%, enter 0.05, not 5. If you enter 5, the result will be wildly off.
  • Mismatched frequency and basis: Ensure frequency matches the actual payment schedule (e.g., 2 for semi-annual). Basis should reflect the day-count convention; using the wrong basis can skew results.
  • Settlement date after maturity date: The function returns a #NUM! error if settlement ≥ maturity.
  • Omitting the basis argument: While optional, omitting it defaults to 0 (30/360). If your security uses actual/actual, specify basis as 1.
  • Using negative values: Coupon rate, yield, and frequency must be positive. Negative values cause errors.

Tips

  • Use cell references instead of hard-coded values so you can easily update inputs.
  • Double-check date formats by formatting cells as dates (Format > Number > Date).
  • For zero-coupon bonds, the DURATION function may not be appropriate; use other functions like DURATION with a coupon of 0? Actually, DURATION requires a coupon; for zero-coupon, duration equals time to maturity, but the function may error. Use manual calculation.
  • Understand the output: Macaulay duration is in years and is useful for assessing interest rate risk. Modified duration can be derived as Macaulay duration / (1 + yield/frequency).
  • Test with known values: Compare with online calculators or Excel's DURATION to verify.
  • Use named ranges for clarity in complex sheets.

Troubleshooting

  • #NUM! error: Check that settlement < maturity, coupon ≥ 0, yield ≥ 0, frequency is 1, 2, or 4, and basis is between 0 and 4. Also ensure dates are valid.
  • #VALUE! error: Likely a non-numeric input or invalid date. Verify all arguments are numbers or date values.
  • Unexpectedly high or low result: Recheck that coupon and yield are decimals, not percentages. Also confirm frequency matches payment schedule.
  • Dates not recognized: Ensure cells are formatted as dates, or use DATE function (e.g., DATE(2025,1,1)).
  • Function not available: DURATION is a standard Google Sheets function; if you see #NAME?, check for typos in the function name.
  • If that did not work: Try breaking down the formula into separate cells for each argument to isolate the issue. Use the formula wizard (Insert > Function) to guide you.

Frequently Asked Questions

What does the DURATION function calculate?

It calculates the Macaulay duration, which is the weighted average time until a bond's cash flows are received, in years. It's a measure of interest rate sensitivity.

Can I use DURATION for zero-coupon bonds?

No, DURATION requires a coupon rate. For zero-coupon bonds, the duration equals the time to maturity, which you can calculate manually.

What is the basis argument and do I need it?

Basis specifies the day-count convention (0=30/360, 1=actual/actual, etc.). It's optional; if omitted, it defaults to 0. Use the basis that matches your security's convention.

Why am I getting a #NUM! error?

Common causes: settlement date on or after maturity, negative coupon or yield, frequency not 1/2/4, or basis out of range. Check each input.

Can DURATION handle different payment frequencies?

Yes, set frequency to 1 (annual), 2 (semi-annual), or 4 (quarterly). Other values cause errors.

Is DURATION available in all versions of Google Sheets?

Yes, it's a built-in function in Google Sheets and works in all current versions.