Calculate Completed Years of Service in Excel Using Hire and Termination Dates
Question details
Calculate completed years of service from the earlier of two service dates to a termination date.

- 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.
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.
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.
Click an empty cell where you want to display the completed years of service.
Type =DATEDIF(MIN(B2:B3),A1,"y") in the selected cell and press Enter.
Confirm that the cell displays the number of full years from the earlier date in B2:B3 through the termination date in A1.

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. Open the spreadsheet: Open WPS Spreadsheet and select Open to load your workbook.
- 2. Enter the dates: Enter the termination date in A1 and the two service dates in B2 and B3.
- 3. Calculate service years: Click an empty cell, enter =DATEDIF(MIN(B2:B3),A1,"y"), and press Enter.
- 4. Save the workbook: Select Menu > Save or Save As to save the result in your workbook.

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.




