How to Calculate Years of Service in Excel (Easy Formulas)

Sumit Bansal
Written by

Sumit Bansal is the founder of TrumpExcel.com and a 13-time Microsoft Excel MVP. He started this site in 2013 to share his passion for Excel through easy tutorials, tips, and training videos, helping you master Excel, boost productivity, and maybe even enjoy spreadsheets!

Last updated

If you have an employee’s joining date, you can calculate their years of service in Excel with a short formula.

Depending on the report, you may need completed years, decimal years, or a result that includes months and days. In this article, I’ll show you the formula for each result, including one that updates automatically every day.

Choose the Right Years-of-Service Formula

Use the table below to match the result you need with the best Excel approach.

Result You NeedRecommended Approach
Completed years between two datesDATEDIF with “y”
Years of service through the current dateDATEDIF with TODAY
Years and remaining monthsDATEDIF with “y” and “ym”
Years, months, and daysLET with EDATE
Decimal yearsYEARFRAC
Future service anniversary dateEDATE

Calculate Completed Years of Service Using DATEDIF

Use this method when you have both a joining date and an end date, and you only need the number of completed years.

Below is an employee list with joining dates in column B and end dates in column C. I want the completed years of service in column D.

Employee joining dates and end dates with an empty Completed Years column

Enter this formula in cell D2:

=DATEDIF(B2:B6,C2:C6,"y")
DATEDIF formula calculating completed years of service for five employees

The DATEDIF formula measures the gap between the two dates. The “y” argument tells Excel to return only completed years.

In Microsoft 365 and newer versions of Excel that support dynamic arrays, this single formula spills all five results into column D.

Pro Tip: If your Excel version does not spill the results, use =DATEDIF(B2,C2,"y") in D2 and fill it down. If you get a #SPILL! error in a newer version, clear the cells below the formula. Spilling formulas also cannot be used inside an Excel Table’s calculated column.

Important: DATEDIF returns #NUM! when the joining date comes after the end date. Dates stored as text can also cause a #VALUE! error. Correct the source dates instead of hiding the error.

Calculate Years of Service in Excel Using TODAY

This method is useful for current employees because the result updates on its own as time passes.

Below is a staff list with each employee’s joining date in column B. I want their completed years of service through today in column C.

Employee joining dates with an empty column for service through today

Enter this formula in cell C2:

=DATEDIF(B2:B6,TODAY(),"y")
DATEDIF with TODAY calculating current completed years of service

The TODAY() formula supplies the current date. DATEDIF then counts the completed years from each joining date through today.

TODAY is a volatile formula, so Excel recalculates it when the workbook opens or another calculation occurs.

Pro Tip: TODAY keeps changing. Use a fixed as-of date instead when you need a historical report that should not change later.

If your list contains current and former employees, add an End Date column. Leave it blank for anyone who still works at the company.

Use this formula to take the end date from column C when one exists, or use TODAY when the cell is blank:

=IF(B2:B6="","",DATEDIF(B2:B6,IF(C2:C6="",TODAY(),C2:C6),"y"))
Formula using an employee end date when present and TODAY when it is blank

This gives you one formula for a mixed employee list without placing TODAY in every row.

The same DATEDIF and TODAY setup can calculate the total time elapsed from a past date or calculate age from a date of birth.

Calculate Service in Years and Months

Completed years are often enough for a report, but an employee may want to see the remaining months as well.

Below is an employee list with joining dates in column B and end dates in column C. I want a result such as “6 Years 9 Months” in column D.

Employee joining and end dates with an empty Service Period column

Enter this formula in cell D2:

=DATEDIF(B2:B6,C2:C6,"y")&" Years "&DATEDIF(B2:B6,C2:C6,"ym")&" Months"
DATEDIF formula returning service as completed years and remaining months

The first DATEDIF returns the completed years. The second uses “ym” to return the months left after those complete years are removed.

The ampersand joins both numbers with the words “Years” and “Months.” This formula also spills down automatically in dynamic-array versions of Excel.

Pro Tip: To calculate service through today, replace both references to C2:C6 with TODAY().

Calculate Service in Years, Months, and Days

If you need a more detailed service period, you can show the remaining days after the completed years and months.

Below is an employee list with joining dates in column B and end dates in column C. I want the full service period in column D.

Employee joining and end dates with an empty Detailed Service column

Enter this formula in D2 and fill it down:

=LET(start,B2,finish,C2,n,12*(YEAR(finish)-YEAR(start))+MONTH(finish)-MONTH(start),wholeMonths,n-(EDATE(start,n)>finish),QUOTIENT(wholeMonths,12)&" Years "&MOD(wholeMonths,12)&" Months "&finish-EDATE(start,wholeMonths)&" Days")
LET formula returning service in years, months, and days

The formula first finds the number of completed calendar months. It then splits that number into years and months and calculates the remaining days from the last monthly anniversary.

This avoids DATEDIF’s “md” argument. Microsoft warns that “md” can return an inaccurate result in some date combinations.

LET is available in Microsoft 365, Excel 2024, and Excel 2021. This formula stays per row because EDATE does not return this calculation as a clean spilling range.

Calculate Decimal Years of Service Using YEARFRAC

Sometimes you need service expressed as a decimal for a prorated benefit or calculation.

Below is an employee list with joining dates in column B and end dates in column C. I want each service period rounded to two decimal places in column D.

Employee joining and end dates with an empty Decimal Years column

Enter this formula in D2 and fill it down:

=ROUND(YEARFRAC(B2,C2,1),2)
YEARFRAC formula returning years of service rounded to two decimal places

YEARFRAC returns the fraction of a year between the start and end dates. The third argument, 1, tells Excel to use the actual number of days in the relevant years.

ROUND limits the displayed result to two decimal places. Remove ROUND if a later calculation needs the full precision.

The INT function can remove the decimal portion, but DATEDIF is clearer when you specifically need completed years.

Calculate a Future Service Anniversary Date Using EDATE

You may also need the date when an employee completes a service milestone, such as 5 or 10 years.

Below is a list with joining dates in column B and the milestone years in column C. I want the anniversary date in column D.

Employee joining dates and milestone years with an empty Anniversary Date column

Enter this formula in D2 and fill it down:

=EDATE(B2,C2*12)
EDATE formula calculating future service anniversary dates

EDATE moves a date by a specified number of months. Multiplying the milestone years by 12 converts them to the number of months EDATE needs.

If Excel displays a serial number instead of a date, apply a date format to the result cells.

Important: Check how your organization treats employees hired on February 29 before using a calculated anniversary date. The recognized anniversary can differ in a non-leap year.

I covered the formulas for completed years, decimal years, detailed service periods, and future service anniversaries.

Use a fixed end date for historical reports and TODAY when the result should keep updating. I hope you found this article helpful.

Other Excel Articles You May Also Like:

Sumit Bansal

Sumit Bansal

13x Microsoft Excel MVP

Hey! I'm Sumit Bansal, founder of trumpexcel.com and a Microsoft Excel MVP. I started this site in 2013 because I genuinely love Microsoft Excel (yes, really!) and wanted to share that passion through easy Excel tutorials, tips, and Excel training videos. My goal is straightforward: help you master Excel skills so you can work smarter, boost productivity, and maybe even enjoy spreadsheets along the way!

1 thought on “How to Calculate Years of Service in Excel (Easy Formulas)”

  1. In the examples you have, there are examples with joining dates. But I have birth date, retirement date. In this situation, how can the left of service be taken out?

    Reply

Leave a Comment

Get the FREE 51 Excel Tips Ebook

Enter your details and the free PDF is on its way to your inbox.

Hmm, that didn't go through. Please check your email and try again.

No spam. You'll also get my weekly Excel newsletter. Unsubscribe anytime.

Check your inbox!

The ebook is on its way to your email. It usually lands within a couple of minutes.