You can use one of the following formulas to calculate years of service from a hire date in Excel:

**Formula 1: Calculate Years of Service in Years and Months (e.g. 14 years, 2 months)**

=DATEDIF(B2,C2,"y") & " years , "& DATEDIF(B2,C2,"ym") & " months"

**Formula 2: Calculate Years of Service in Years as Decimal (e.g. 14.16944 years)**

=YEARFRAC(B2, C2)

**Formula 3: Calculate Years of Service in Years as Whole Number (e.g. 14 years)**

=INT(YEARFRAC(B2, C2))

Each formula assume that the start date is in cell **B2** and the end date is in cell **C2**.

The following examples show how to use each formula in practice with the following dataset in Excel:

**Example 1: Calculate Years of Service in Years and Months**

We can type the following formula into cell **D2** to calculate the years of service for the first employee in terms of years and months:

=DATEDIF(B2,C2,"y") & " years , "& DATEDIF(B2,C2,"ym") & " months"

We can then drag and fill this formula down to each remaining cell in column D to calculate the years of service for each employee:

The values in column D display the years of service for each employee in terms of years and months.

**Example 2: Calculate Years of Service in Years as Decimal**

We can type the following formula into cell **D2** to calculate the years of service for the first employee in terms of years as a decimal:

=YEARFRAC(B2, C2)

We can then drag and fill this formula down to each remaining cell in column D to calculate the years of service for each employee:

The values in column D display the years of service for each employee in terms of years as a decimal.

For example:

- Andy was with the company for
**14.169 years**. - Ben was with the company for
**3.894 years**. - Charles was with the company for
**9.281 years**.

And so on.

**Note**: You can find the complete documentation for the Excel **YEARFRAC** function here.

**Example 3: Calculate Years of Service in Years as Whole Number**

We can type the following formula into cell **D2** to calculate the years of service for the first employee in terms of whole years:

=INT(YEARFRAC(B2, C2))

We can then drag and fill this formula down to each remaining cell in column D to calculate the years of service for each employee:

The values in column D display the years of service for each employee in terms of whole years.

**Note**: The last employee shows **0** years of service because he did not belong to the company for at least one whole year.

**Additional Resources**

The following tutorials explain how to perform other common operations in Excel:

How to Calculate the Difference Between Two Dates in Excel

How to Calculate the Number of Months Between Dates in Excel

How to Apply Conditional Formatting Based on Date in Excel