# Excel: Calculate Years & Months Between Two Dates

You can use the following formula to calculate the number of years and months between two dates in Excel:

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

This particular formula will return the number of years and months between the start date in cell A2 and the end date in cell B2.

For example, if cell A2 contains 1/4/2005 and cell B2 contains 1/1/2022 then this formula will return 16 years 11 months.

The following examples show how to use each formula in practice.

## Example: Calculate Years & Months Between Two Dates in Excel

Suppose we have the following list of start and end dates in Excel: Suppose we would like to calculate the number of full years and months between the start and end dates in each row.

We can type the following formula into cell B2 to do so:

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

We can then click and drag this formula down to each remaining cell in column B: Column C now displays the number of full years and months between the start date and end date in each row.

Note that you can also format the output in a different way if you’d like.

For example, you could use the following formula to add a comma between the years and months:

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

The following screenshot shows how to use this formula in practice: The years and months now have a comma in between them in the output of column C.

Note: You can find the complete documentation for the DATEDIF function in Excel here.