# How to Calculate the Number of Months Between Dates in Excel

To calculate the number of months between two dates in Excel, you can use the DATEDIF function or the YEAR and MONTH functions. Here's how to use both methods:

## Method 1: Using DATEDIF Function

The DATEDIF function calculates the difference between two dates in various units like years, months, and days.

Syntax:

`DATEDIF(start_date, end_date, unit)`

- Open Microsoft Excel and enter the start date in cell A1 and the end date in cell B1.
- In cell C1, enter the following formula:

`=DATEDIF(A1, B1, "m")`

- Press Enter, and the number of months between the two dates will be displayed in cell C1.

## Method 2: Using YEAR and MONTH Functions

The YEAR and MONTH functions can also be used to calculate the number of months between two dates.

- Open Microsoft Excel and enter the start date in cell A1 and the end date in cell B1.
- In cell C1, enter the following formula:

`=(YEAR(B1) - YEAR(A1)) * 12 + MONTH(B1) - MONTH(A1)`

- Press Enter, and the number of months between the two dates will be displayed in cell C1.

## Example

Let's use the DATEDIF function to calculate the number of months between January 1, 2020, and September 15, 2021.

- Open Microsoft Excel and enter the start date (1/1/2020) in cell A1 and the end date (9/15/2021) in cell B1.
- In cell C1, enter the following formula:

`=DATEDIF(A1, B1, "m")`

- Press Enter, and the number of months between the two dates (20 months) will be displayed in cell C1.

Did you find this useful?