Function Problems

How to Calculate Years and Months of Service in One Excel Cell with DATEDIF in WPS Office

Steve KSteve K Nov 13, 2026 869 views

Question details

The user needs a DATEDIF formula that calculates complete years and remaining months from an employee's start date to today and combines the values into one readable cell.

How to Calculate Years and Months of Service in One Excel Cell with DATEDIF in WPS Office
Product
WPS Office Spreadsheets
Device & OS
not provided
Scenario
The user maintains employee records and wants to display length of service in a single cell using a start date, for example D2.
Observed behavior
The goal state is to see a readable result such as "3 year(s) and 4 month(s)" in the selected cell.
Before you start

Verify that start dates are entered as real date values rather than text. If the result cell is formatted as Text, switch it to General before entering the formula.

Solution 1Recommended

Use DATEDIF to Combine Years and Remaining Months in One Cell

Use this when you have a start date in a cell and need an automatically updated length of service sentence in one spreadsheet cell.

DATEDIF returns the complete elapsed units between two dates. The "y" unit returns complete years, and "ym" returns the remaining whole months after those complete years.

The formula joins both results with text so the final value reads naturally, for example "5 year(s) and 7 month(s)".

1
Open the workbook and select the result cell

Open your workbook in WPS Office Spreadsheets and click the cell where the service length should appear.

2
Enter the DATEDIF combined formula

Type =DATEDIF(D2,TODAY(),"y")&" year(s) and "&DATEDIF(D2,TODAY(),"ym")&" month(s)" and press Enter.

3
Copy the formula to other employee rows

Drag the fill handle down from the result cell to copy the formula to other start date rows in the same column.

Use DATEDIF to Combine Years and Remaining Months in One Cell
Result updates automatically: Because the formula uses TODAY(), the service length recalculates whenever the workbook opens, so it stays current without manual edits.

Calculate Service Length in One Cell with WPS Spreadsheets

WPS Office Spreadsheets supports DATEDIF, so you can create the same years-and-months service formula in a free, familiar spreadsheet interface and keep working with your existing Excel files.

  1. 1. Download WPS Office: Go to the official WPS Office download page and install WPS Office on your computer.
  2. 2. Open the employee workbook: Open your existing .xlsx or .xls file in WPS Office Spreadsheets.
  3. 3. Enter the DATEDIF service formula: Click the result cell, type =DATEDIF(D2,TODAY(),"y")&" year(s) and "&DATEDIF(D2,TODAY(),"ym")&" month(s)", and press Enter.
  4. 4. Apply the formula to other rows: Drag the fill handle down the column to calculate service length for other employees.
Calculates complete years and remaining months with DATEDIF in one cellOpens and saves Microsoft Excel .xlsx and .xls workbooksFree spreadsheet app with a familiar Excel-like interfaceTODAY() keeps service length current without manual updates
microsoft office alternative - wps office

Frequently Asked Questions

Why does my DATEDIF formula return #NUM!?

This usually means the start date is later than TODAY() or the cell does not contain a valid date. Check that D2 is formatted as a date and is earlier than the current date.

Can I change the wording "year(s) and month(s)"?

Yes. Edit the text inside the quotation marks in the formula, for example change " year(s) and " to " years, ".

Does DATEDIF work in WPS Office Spreadsheets?

Yes. WPS Office Spreadsheets supports the DATEDIF function, so you can use the same English formula shown here.

How can I show only total months of service?

Use =DATEDIF(D2,TODAY(),"m") in an empty cell to return the total number of complete months between the start date and today.

What if my dates are stored as text?

Select the date cells and set the number format to Date, or re-enter the dates. You can also use DATE(year,month,day) to create a valid date value.