Calculation Issues

Calculate Completed Years of Service in Excel Using Hire and Termination Dates

Bushra ParveenBushra Parveen Nov 25, 2026 869 views

Question details

Calculate completed years of service from the earlier of two service dates to a termination date.

Calculate Completed Years of Service in Excel
Product
Microsoft Excel
Device & OS
not provided
Scenario
A worksheet contains two possible service start dates and a termination date.
Observed behavior
The desired result is the number of full years between the earlier service date and the termination date.
Before you start

Enter the termination date in A1 and the two service dates in B2 and B3 as valid Excel dates. Check that the termination date is not earlier than the earlier service date.

Solution 1Recommended

Use DATEDIF and MIN to calculate completed service years

Use this formula when the termination date is in A1 and the two possible start dates are in B2 and B3.

1
Select the result cell

Click an empty cell where you want to display the completed years of service.

2
Enter the formula

Type =DATEDIF(MIN(B2:B3),A1,"y") in the selected cell and press Enter.

3
Check the result

Confirm that the cell displays the number of full years from the earlier date in B2:B3 through the termination date in A1.

Use DATEDIF and MIN to calculate completed service years
Full years only: The "y" argument counts completed years and excludes any remaining months or days. Adjust the cell references if your dates are in different locations.
Calculate service years in WPS

Calculate Completed Years of Service in WPS Spreadsheet

Use the same DATEDIF and MIN formula in WPS Spreadsheet to find full years of service from the earlier start date to the termination date.

  1. 1. Open the spreadsheet: Open WPS Spreadsheet and select Open to load your workbook.
  2. 2. Enter the dates: Enter the termination date in A1 and the two service dates in B2 and B3.
  3. 3. Calculate service years: Click an empty cell, enter =DATEDIF(MIN(B2:B3),A1,"y"), and press Enter.
  4. 4. Save the workbook: Select Menu > Save or Save As to save the result in your workbook.
Calculate completed service years with a single formulaOpen and edit Microsoft Excel XLSX filesUse a familiar spreadsheet interfaceWork with spreadsheet files in WPS Office for free
microsoft office alternative - wps office

Frequently Asked Questions

How does the formula choose the service start date?

MIN(B2:B3) selects the earlier date in cells B2 and B3. DATEDIF then uses that date as the start date.

Does the formula include partial years?

No. The "y" argument in DATEDIF returns only completed years, so remaining months and days are not included.

Why does DATEDIF return a #NUM! error?

Check whether the termination date in A1 is earlier than the start date selected by MIN. DATEDIF requires the start date to be on or before the end date.

Can I use different cells for the dates?

Yes. Replace B2:B3 with the range containing the service dates and replace A1 with the cell containing the termination date.