Function · Date and time
Excel YEARFRAC function
The Excel YEARFRAC function returns the fraction of a year between two dates. From January 1, 2026 to July 4, 2026, actual days over actual year length is about 0.504110.
Syntax =YEARFRAC(start_date, end_date, [basis])
=YEARFRAC(DATE(2026,1,1),DATE(2026,7,4),1)Arguments
| Name | Required | What to pass |
|---|---|---|
| start_date | Required | The start date, written first. |
| end_date | Required | The end date. |
| basis | Optional | 0 or omitted is 30/360 US. 1 is actual days divided by the actual year. 2 is actual/360. 3 is actual/365. 4 is 30/360 European. |
Examples
Actual fraction of 2026 from New Year's Day to Independence Day
=YEARFRAC(DATE(2026,1,1),DATE(2026,7,4),1)Result 0.504110
| A | B | |
|---|---|---|
| 1 | Start | 1/1/2026 |
| 2 | End | 7/4/2026 |
| 3 | Fraction | 0.504110 |
YEARFRAC divides a span by a year. From January 1, 2026 to July 4, 2026 is 184 actual days, and 2026 has 365 days, so basis 1 returns 184/365, about 0.504110. Leave basis off and Excel uses the US 30/360 rule instead. That answer is not 184 over 365.
Basis 3 always divides by 365, even in a leap year. Basis 2 divides actual days by 360. Basis 0 and 4 are the two 30/360 methods that DAYS360 separates into FALSE and TRUE. The argument order is start then end, which is the opposite of DAYS. A contract that names an actual/actual day count needs the 1. A contract that names 30/360 needs the basis that matches its method, not the one Excel assumes. Those same codes, 0 through 4, are the day-count argument on YIELD, PRICE, and ACCRINT.