Sometimes we need to calculate days, months, or dates between two dates which are very tiresome to calculate manually. But in Google Sheets, we can easily calculate the day, month, or year between two dates using functions quickly and easily. In this article, you will learn how to calculate the number of years between two dates in Google Sheets.

**Table of Contents**hide

## A Sample of Practice Spreadsheet

Click the link below to make a copy of the practice spreadsheet.

## 2 Easy Ways to Calculate Number of Years Between Two Dates in Google Sheets

Suppose that you have the dataset of buying date and expiry date of a product. Now you want to know the years this product lasted.

You can use functions like **DATEDIF**, and **YEARFRAC **in Google Sheets to calculate the number of years between two dates easily. Follow the below sections to learn how to use functions in Google Sheets to calculate the number of years between dates.

### 1. Using DATEDIF Function

You can calculate the date difference between the dates using the **DATEDIF** function. Using this function number of days, months and years can be calculated. Follow the steps below to calculate the number of years between those two dates in Google Sheets.

- First of all, select cell
**C8**of**No of Years**row.

- Now, type the function and cell references,
**=DATEDIF(C5, C6,**. Now, to return the number of full years type**“Y”**.

`=DATEDIF(C5,C6,"Y")`

- Lastly, press
**Enter**and the number of years will be shown in cell**C8**.

**Read More: ****How to Calculate Time Between Dates in Google Sheets (6 Ways)**

### 2. Utilizing YEARFRAC Function

Another way to calculate years between dates is to use the **YEARFRAC **function. Using this function you can only return the number of years. Follow the below steps.

- In the beginning, select cell
**C8**in the**No.****of Years**row.

- Then, enter the following formula. Here
**the****INT function**is used so that the number of years results in an integer number.

`=INT(YEARFRAC(C5, C6))`

- Finally, press
**Enter**and the output will look like the following screenshot.

**Read More: ****How to SUMIF Between Two Dates in Google Sheets (3 Ways)**

## How to Calculate Months and Days Between Two Dates in Google Sheets

We can also calculate months and days between two dates in Google Sheets using the same function used to calculate years. Follow the steps below-

- First, select
**C8**in**No.****of Months**row.

- Afterward, type the function and cell references,
**=DATEDIF(C5, C6,**. Now, to return the number of full months type**“M”**.

`=DATEDIF(C5,C6,"M")`

- Finally, press
**Enter**and the number of years will be shown in cell**C8**.

- Similarly, to return the number of days use the following formula in cell
**C9**in**No. of Days**row.

`=DATEDIF(C5,C6,"D")`

**Read More: ****Find Number of Months Between Two Dates in Google Sheets**

## Things to Remember

- Remember to use the
**INT**function to output an integer number when using the**YEARFRAC**function. - Input the starting date first, followed by the ending date.

## Conclusion

These are the ways to calculate the number of years between two dates in Google Sheets. As you can see, there are various methods for calculating the difference between two dates. Visit our website, **OfficeWheel**, for more articles on using functions.

## Related Articles

**How to Calculate Hours Between Two Times in Google Sheets****Find Unique Values Between 2 Columns in Google Sheets****How to Filter Between Two Dates in Google Sheets****Generate Random Numbers or Text Between Limits in Google Sheets****How to Find Correlation Between Two Columns in Google Sheets****Difference Between COUNT and COUNTA in Google Sheets****Google Sheets Count Cells Between Two Numbers with COUNTIF Function**