Number of Years Between Dates in Excel & Google Sheets

Written by

Editorial Team

Reviewed by

Steve Rynearson

Last updated on February 6, 2023
Download Example Workbook

Download the example workbook

This tutorial will demonstrate how to calculate the number of years between two dates in Excel & Google Sheets.

years between dates

 

DATEDIF Function

To calculate the number of years between dates you can use the DATEDIF Function with unit of measurement “y” for years:

=DATEDIF(B3,C3,"y")

DATEDIF Y

The DATEDIF Function returns the number of full years between two dates. It will not give you a fractional value.

Next you can use the “ym” input with the DATEDIF function to return the remaining number of months:

=DATEDIF(B3,C3,"ym")

DATEDIF YM

and join them together to output the number of years and months between two dates:

=DATEDIF(B3,C3,"y")&"Years and"&DATEDIF(B3,C3,"ym")&" Months"

Service

YEARFRAC Function

Instead if you want to determine the number of years, including fractional values you can use the YEARFRAC Function:

=YEARFRAC(B3,C3)

YEARFRAC

You can add in the TRUNC or INT Functions to calculate the number of full years (just like the DATEDIF Function):

=TRUNC(YEARFRAC(B3,C3))

YEARFRAC trunc

Or you can use the ROUND Function to round to the nearest year:

=ROUND(YEARFRAC(B3,C3),0)

YEARFRAC Round

Last, you can use the ROUNDUP Function to count any partial year as a full year:

 

=ROUNDUP(YEARFRAC(B3,C3),0)

YEARFRAC RoundUP

Number of Years Between Dates in Google Sheets

All of the above examples work exactly the same in Google Sheets as in Excel.

Number of Years Between Dates Google

AI Formula Generator

Try for Free

Excel Practice Worksheet

practice excel worksheet

Practice Excel functions and formulas with our 100% free practice worksheets!

  • Automatically Graded Exercises
  • Learn Excel, Inside Excel!

Free Download

Return to Excel Formulas List