# How to calculate Length of Service?

The calculation of the length of service in Excel can consume a lot of energy, but we will do it together at ease.

## Recording employee data

1. Record the employee's start and end dates. You should click on the column (1), and type in the date (2). Repeat the 1 & 2 on all employees.

Note: It is recommended that you put the employees' names in column A to know how long they have worked for the company.

## How to calculate years of service?

2. Click on the column (1), type in =DATEDIF(A2,B2,"y")&" years "&DATEDIF(A2,B2,"ym")&" months" (2), and hit enter.

It should be noted that the cells can be replaced with any other cells, for example, D2:E2.

3. If you don't need to see months you can modify the fomula a bit.

=DATEDIF(A2, B2, "y")& " years" formula will provide you a number of years without the months.

Alternatively, you can use =INT(YEARFRAC(A2,B2)) as well.

4. In case you need more precise data try using this one:

=DATEDIF(A2,B2,"y") & " years " & DATEDIF(A2,B2,"ym") & " months " & DATEDIF(A2,B2,"md") & " days"

Such a Datedif formula will provide you with the date difference in years, months, and even days.

Still not enough? Please visit how to calculate difference in Excel.