Table of Contents
This guide explains how to use YEARFRAC Function in Excel, including its syntax, required arguments, practical examples, and common errors.

Description: The function returns the fifth as a whole number of days between two specific dates in Excel.
Syntax: YEARFRAC (start_date, end_date, [basis])
Inside:
- start_date: The start date to calculate the number of years, is a required parameter.
- end_date: The desired date to calculate the number of years, is a required parameter.
- basis: The basis for determining how to count dates, is an optional parameter including the following values:
+ basis = 0 -> Base counting days in US (NASD) 30/360.
+ basis = 1 -> Basis counting days is the actual number of days / actual year.
+ basis = 2 -> The basis of counting days is the number of actual days / 1 year 360 days.
+ basis = 3 -> Basis for counting days is the actual number of days / year with 365 days.
+ basis = 4 -> Base counting days according to EUROPEAN 30/360.
Attention:
- Excel stores the date as a serial number to facilitate the calculation process.
- All function arguments, if it is a decimal -> are truncated to integers.
- If the value of start_date, end_date is not a valid date -> the function returns the #VALUE! Error value
- If basis is outside of values 0 to 4 -> the function returns the #NUM! Error value
For example:
Calculate the number of years corresponding to the following time period:

- In the cell to calculate enter the formula: = YEARFRAC (E7, F7, G7).

- Press Enter -> the value corresponding to the above 2 dates is:

- Similarly copying the formula for the remaining values results:

- Where the basis value is outside the scope of its values -> the function returns the #NUM! Error value

Above are instructions and some specific examples when using the YEARFRAC function in Excel.
Good luck!
FAQ
What does the YEARFRAC function do in Excel?
The YEARFRAC function performs the calculation described in this guide. Use the correct arguments and compatible data types for reliable results.
How do I enter the YEARFRAC function correctly?
Start with an equals sign, enter YEARFRAC, add the required arguments inside parentheses, and confirm that cell references and separators are correct.
Why does the YEARFRAC function return an error?
Common causes include missing arguments, invalid data types, incorrect cell references, unsupported values, or regional separator settings.
Reader Comments 0
Sign in with email or Google to join the discussion.