DURATION Function in ONLYOFFICE Spreadsheet Editor: Syntax and Examples
Calculate Macaulay duration in years from discounted regular coupon cash flows, with an independently checked two-payment example.
Verification status: See the evidence and test scope described in this guide. How formula examples are checked
Quick answer
=DURATION(DATE(2026,12,15),DATE(2028,12,15),0.10,0.10,1,0) is expected to return approximately 1.90909090909 years. This is Macaulay duration: the present-value-weighted average time of the modeled bond’s cash flows. It is not simply the two years remaining to maturity and is not the modified duration used directly in a small-yield-change price approximation.
Syntax, rates and schedule
=DURATION(settlement, maturity, coupon, yld, frequency, [basis])
coupon and yld are annual rates, supplied as decimals or numeric percentages. Enter 0.10 or 10%, not 10 for ten percent. frequency is 1, 2 or 4 payments per year; the implementation divides the annual rates by frequency internally. Do not divide them again before passing them.
Basis defaults to 0 when omitted. The documented codes are 0 US (NASD) 30/360, 1 actual/actual, 2 actual/360, 3 actual/365 and 4 European 30/360. Use DATE for unambiguous numeric dates, settlement strictly before maturity, and consistent monetary units. Brackets mark optional syntax and are not typed.
The function infers regular coupons from maturity and frequency and assumes a redemption of 100 in the source helper. There is no face-value, first-coupon, call-date or holiday-calendar argument. The normalized face value does not change a weighted-average time, but unusual redemption amounts or irregular schedules cannot be specified through this interface.
Step-by-step: verify a two-year annual bond
- Put
=DATE(2026,12,15)in A2 and=DATE(2028,12,15)in B2. - Enter coupon
0.10in C2, yield0.10in D2, frequency1in E2 and basis0in F2. - In G2 enter
=DURATION(A2,B2,C2,D2,E2,F2). - Format G2 as a number with sufficient decimal places and label it
Macaulay duration (years).
Settlement is on a regular coupon boundary; the modeled future payments are 10 one year later and 110 two years later. Independently discount and weight them:
| Time, years | Cash flow per 100 | Present value at 10% | Time × present value |
|---|---|---|---|
| 1 | 10 | 9.09090909091 | 9.09090909091 |
| 2 | 110 | 90.9090909091 | 181.818181818 |
| Total | 120 | 100 | 190.909090909 |
Dividing the weighted sum by present value gives 1.90909090909 years. The first coupon pulls the weighted time below maturity. The source’s final division by frequency converts its coupon-period weights into years.
Further controls
| Formula | Expected duration, years |
|---|---|
=DURATION(A2,B2,0,0.10,1,0) |
2 |
=DURATION(A2,B2,0.10,0,1,0) |
1.91666666667 |
=DURATION(A2,B2,0.06,0.04,2,0) |
1.91610687701 approximately |
=DURATION(A2,B2,0.10,0.10,1) |
1.90909090909 approximately, default basis 0 |
The zero-coupon example has only a final redemption, so its weighted time is two years. At zero yield, the annual example’s weighting is (1×10+2×110)/(10+110)=230/120. The semiannual example uses four payments at 0.5, 1, 1.5 and 2 years, with coupons 3 and a final payment 103, discounted at 2% per half-year.
Advanced use: distinguish duration measures
For the main example, modified duration is Macaulay duration divided by 1+yld/frequency: 1.90909090909/1.10 ≈ 1.73553719008. MDURATION performs that adjustment. Do not substitute Macaulay duration directly into a modified-duration sensitivity formula without converting it.
Between coupon dates, the source computes the first fractional period from (COUPDAYS−COUPDAYBS)/COUPDAYS. That is a basis-specific modeling convention, not always a literal calendar-time fraction. In particular, the actual/360 and actual/365 coupon helpers can use a conventional period denominator different from elapsed-plus-remaining actual days. The clean coupon-boundary examples avoid this ambiguity; use the intended basis consistently in a real model.
Errors and compatibility cautions
Negative coupon or yield, invalid frequency, basis outside 0–4, or settlement at/after maturity returns #NUM! in the inspected wrapper after conversion. Zero coupon and zero yield are allowed. Date serials, frequency and basis are floored; supply whole-day dates and deliberate integer settings.
Month-end and leap-day anchors require separate schedule checks because the date helpers perform month/year adjustments. No business-day calendar or optionality model is present. Use this as a regular fixed-cash-flow calculation; it does not model a callable bond’s changing cash flows or certify a risk estimate across large yield movements.
Availability and verification scope
Checked October 18, 2026 against the official DURATION help and official SDKJS source tagged v10.0.0.169. Desktop Editors 10.0 was released October 13, 2026. The original introduction version for this individual function is not established; current help does not mark it retired or deprecated.
All results in this guide are expected values from documentation, source inspection and independent arithmetic, not application observations. Neither the application nor its calculation engine was used to test these examples. The tag matches the installed version/build designation but does not establish identical behavior in every older release, mobile client, server deployment or imported workbook. Examples use English names and comma argument separators; adapt separators to editor settings. These fictional calculations explain a function, not an investment or borrowing recommendation.