We often compare two dates and calculate the difference between them in terms of days, weeks, months and years. In Excel, we can calculate years between dates using specialized functions like YEARFRAC and DATEDIF functions. This step by step tutorial will help all levels of Excel users calculate the number of years between two dates.
Figure 1. Calculating Years Between Dates
Using YEARFRAC Function to Calculate Years Between Dates
The YEARFRAC function calculates years between two dates, including the fractional value. The decimal number represents the fraction of the year between the dates. The formula to get the difference between dates in terms of years, including fraction, is;
Apply this formula in cell D2 and drag the fill handle to get the other calculations.
Figure 2. Applying the YEARFRAC Function
To round the decimal number or fractional value to nearest whole number we can wrap the above formula in the ROUND function, such as;
Figure 3. Rounding the Fractional Value to Nearest Whole Number
If we want to return only the integer part of the year’s value without fractional value, then we need to wrap the YEARFRAC function inside the INT function, such as;
Figure 4. Getting the Year Value Without Fractional Value
Using DATEDIF Function to Calculate Years Between Dates
The DATEDIF function calculates the number of years between two dates when the interval argument is specified as “Y” as per its syntax, such as;
=DATEDIF( start_date, end_date, “Y” )
When we apply this function with “Y” interval then it calculates years between two dates a complete calendar year without fractional value. As per our example, we need to apply the following DATEDIF formula in cell D2, and copy or drag down the fill handle to other cells;
Figure 5. Calculating Years Between Dates with DATEDIF Function
Instant Connection to an Expert through our Excelchat Service
Most of the time, the problem you will need to solve will be more complex than a simple application of a formula or function. If you want to save hours of research and frustration, try our live Excelchat service! Our Excel Experts are available 24/7 to answer any Excel question you may have. We guarantee a connection within 30 seconds and a customized solution within 20 minutes.