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.

Excel 2007 and later. Also in Excel for the web and Google Sheets.

Syntax =YEARFRAC(start_date, end_date, [basis])

YEARFRAC
=YEARFRAC(DATE(2026,1,1),DATE(2026,7,4),1)

Arguments

NameRequiredWhat to pass
start_dateRequiredThe start date, written first.
end_dateRequiredThe end date.
basisOptional0 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

=YEARFRAC(B1,B2,1)B3
Year fraction
AB
1Start1/1/2026
2End7/4/2026
3Fraction0.504110
A picture of the sheet, not a live calculator. Basis 1 is written in the formula. Omit it and Excel uses 30/360.

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.