Excel Formula: Count Months Between Two Dates
In this tutorial, it provides formulas to count months between two given dates.
Get number of complete months between dates
Syntaxt and Arguments
|Start_date, end_date: the two dates that you want to get months difference between.|
The formula returns a whole numeric value that indicates the number of months.
1 While the start_date is greater than the end_date, the formula returns an error value #NUM!
2 While the start_date or end_date is not valid dates (a text value or not a valid date in Excel such as dates before 1/1/1900), the formula returns an error value #VALUE!
How this formula works
To count the number of months between dates in cell B3 and C3, please use below formula:
Press Enter key and drag fill handle over the cells that need this formula.
DATEDIF function: returns the number of complete years, months or days between dates.
The formula calculates and round the number of months down, if you want to get the nearest whole month, you can use the formula as this:
Get number of decimal months between dates
Syntax and Arguments
|Date1, date2: the two dates that you count the number of months based on.|
The formula returns a value in date format, and you need to format the result as number.
How the formula works
To count the months between the dates in cell B3 and C3, please use the formula as this:
Press Enter key then drag fill handle down to the cells for applying this formula.
Keep the formula result selected, and press Ctrl + 1 to display the Format Cells dialog, then under Number tab, click Date from the Category list, choose the date type you want to display in the Type section.
Click OK, the result is shown as date.
YEARFRAC function: calculates the fractional year in a decimal format between given dates. Basic formula is YEARFRAC(date1,date2), to multiply 12 at the end of the formula, will get the fractional months in a decimal format between dates.
If you want to get the whole number of months by the YEARFRAC function, you can add the INT function in the front of the YEARFRAC function like this:
It counts month rounded down.
- Get first day or last day by month text name
Let’s say there is a table containing the year and the month text name for you to get the first day of the month, which formula can you use in Excel?
- Count days until expiration date
To count the days between today and each expiration date in Excel by formula
- Display current date or time
This tutorial provides formulas to show the current date or time in Excel.
- Create weekly date range
In this tutorial, it provides a formula to quickly get the weekly date range in Excel.
- Excel WEEKNUM Function
Returns the week number of the given date in a year
- Excel WORKDAY Function
Adds workdays to the given start date and returns a workday
- Excel MONTH Function
The MONTH is used to get the month as integer number (1 to 12) from date
- Excel DAY Function
DAY function gets the day as a number (1 to 31) from a date
- Excel NOW Function
Get the current time and date