YEARFRAC function in Google Sheets
Returns the number of years, including fractional years, between two dates using a specified day count convention.
=YEARFRAC(start_date, end_date, [day_count_convention])YEARFRAC syntax and parameters
Three arguments, two required.
- start_dateanyRequired
The start date to consider in the calculation. Must be a reference to a cell containing a date, a function returning a date type, or a number.
- end_dateanyRequired
The end date to consider in the calculation. Must be a reference to a cell containing a date, a function returning a date type, or a number.
- day_count_conventionnumberOptional
[ OPTIONAL - 0 by default ] - An indicator of what day count method to use. 0 indicates US (NASD) 30/360 - This assumes 30 day months and 360 day years as per the National Association of Securities Dealers standard, and performs specific adjustments to entered dates which fall at the end of months. 1 indicates Actual/Actual - This calculates based upon the actual number of days between the specified dates, and the actual number of days in the intervening years. Used for US Treasury Bonds and Bills, but also the most relevant for non-financial use. 2 indicates Actual/360 - This calculates based on the actual number of days between the specified dates, but assumes a 360 day year. 3 indicates Actual/365 - This calculates based on the actual number of days between the specified dates, but assumes a 365 day year. 4 indicates European 30/360 - Similar to 0, this calculates based on a 30 day month and 360 day year, but adjusts end-of-month dates according to European financial conventions.
YEARFRAC examples
Formulas you'll actually reuse.
The fraction of a year between two dates on the default 30/360 basis:
=YEARFRAC(DATE(2026, 1, 15), DATE(2026, 9, 3))Result
0.6333The same on an actual/actual basis (1) — 231 real days over 365:
=YEARFRAC(DATE(2026, 1, 15), DATE(2026, 9, 3), 1)Result
0.6329
YEARFRAC in Excel
Same name — your formula ports as-is.
Try YEARFRAC in the playground
Edit the example — nothing to install.
Preloaded with the YEARFRAC formula from Example 1 — change anything and watch it respond.
YEARFRAC errors
What they mean — and the fixes.
#NUM!The basis isn't 0–4.
Related functions
More ways Google Sheets gets this done.
- DATEConverts a provided year, month, and day into a date.DateExcel
- DATEDIFCalculates the number of days, months, or years between two dates.DateExcel
- DATEVALUEConverts a provided date string in a known format to a date value.DateExcel
- DAYReturns the day of the month that a specific date falls on, in numeric format.DateExcel
- DAYSReturns the number of days between two dates.DateExcel
- DAYS360Returns the difference between two days based on the 360 day year used in some financial interest calculations.DateExcel