The Excel YEARFRAC function returns the year fraction representing the number of whole days between start_date and end_date serial numbers.
This function is useful for calculating the portion of a whole year for use in other calculations and is particularly useful in HR/employee related calculations.
Excel YEARFRAC Function Syntax
Syntax: | =YEARFRAC(start_date, end_date, [basis]) |
start_date | A date in a format Excel recognises known as the date-time serial number, or text |
end_date | A date in a format Excel recognises known as the date-time serial number, or text |
[basis] | This optional argument allows you to specify the day count method from the list of options below. If omitted, it defaults to 0.
![]() |
Excel YEARFRAC Function Examples

Tip: You're most likely to use basis 1, unless your business uses a specific system.
Note 1: #NUM! Errors are returned if the basis argument is <0 or >4.
Note 2: Only the date portion of a date-time serial number is used by YEARFRAC. Any time element is ignored. As a result, only whole days are returned.
Free eBook - Working with Date & Time in Excel
Everything you need to know about Date and Time in Excel, including all Date functions explained with examples - Download the free eBook and Excel file with detailed instructions.
Enter your email address below to download the sample workbook.
Download the Excel Workbook and PDF. Note: This is a zip file including an Excel workbook with detailed instructions and a PDF version for your reference.
Related Tutorials
Excel NETWORKDAYS Function | Returns the number of whole networkdays (excluding weekends & holidays), between two dates |
Excel NETWORKDAYS.INTL Function | Returns the number of whole networkdays (excluding weekends & holidays), between two dates, using parameters to specify weekend days |
Excel DAYS Function | Calculates the number of days between 2 dates |
Excel DAYS360 Function | Calculates the number of days between 2 dates, based on a 360-day year (12 x 30-day months) |
Excel DATEDIF Function | Calculates the number of days, months, or years between two dates. This function is useful in formulas where you need to calculate an age. |