## How to Calculate years between dates?

We can calculate years between dates in excel by using –`=`

**YEARFRAC().**

**What is YEARFRAC()?**

**YEARFRAC()** is a function that returns the days between two dates as a year fraction.

**Formula**

**=YEARFRAC(start_date,end_date)**

Let us go through an example to understand it better.

**How to use the Formula to Calculate years between dates?**

*Figure 1. Example 1 of **YEARFRAC() **to Calculate years between dates*

In this example, you have a small table containing starting and ending dates. To apply **YEARFRAC()** on this table:

- Select any column, where you want to display years between dates for any starting and ending dates. In this case it is
**H5**. - In the function box, type
**YEARFRAC() FUNCTION.** - Give the arguments i.e. the starting and ending date. For
**H5,**assign the**F5:G5.**Since the dates have the same year so, the answer is less than 1.

## An alternative way to calculate years between dates

*Figure 2. Example 1 of **DATEDIF() **to calculate years between dates*

You can also calculate years between dates by using** DATEDIF()** function. Let’s see how to do this:

- Select any column, where you want to display years between dates for any starting and ending dates. In this case, it is
**H5**. - In the function box, type
**DATEDIF() FUNCTION.** - Give the arguments i.e. the
**starting**,**ending date**and**“Y”**to tell the function to give out years. For**H5,**assign the**F5:G5.** - Since the dates have the same year so, the answer is 0. The YEARFRAC() returns fraction but this formula returns the whole number.

## Leave a Comment