Function Problems

How to Use Excel DATEDIF to Calculate Months Between Dates

Algirdas JasaitisAlgirdas Jasaitis Dec 2, 2026 868 views

Question details

The user wants to calculate the number of complete months between two dates using Excel's DATEDIF function.

How to Use Excel DATEDIF to Calculate Months Between Dates
Product
Microsoft Excel
Device & OS
not provided
Scenario
The user wants to enter DATEDIF to calculate elapsed months but cannot find it in the function list.
Observed behavior
DATEDIF may not appear in Excel's function list or Formula AutoComplete, but it can still work when typed directly into a cell.
Before you start

Enter valid Excel dates in cells A1 and B1, with the earlier date in A1. DATEDIF returns an error if the start date is later than the end date.

Solution 1Recommended

Enter DATEDIF Manually to Count Complete Months

Use this method when DATEDIF is missing from the function list or Formula AutoComplete.

DATEDIF is retained for compatibility with older Lotus 1-2-3 files, so Excel may not suggest it as you type. The "m" unit counts complete months, not partial months.

1
Enter the dates

In the worksheet, enter the earlier date in A1 and the later date in B1.

2
Type the formula

Select an empty cell and type =DATEDIF(A1,B1,"m"). If your regional settings use semicolons as argument separators, enter =DATEDIF(A1;B1;"m") instead.

3
Calculate the result

Press Enter. The cell displays the number of complete months between the dates.

Enter DATEDIF Manually to Count Complete Months
Check date errors: If the formula returns #NUM!, check that A1 is not later than B1. If it returns #VALUE!, check that both cells contain valid dates rather than unrecognized text.
Calculate dates in WPS Spreadsheets

Calculate Complete Months with DATEDIF in WPS Spreadsheets

Use DATEDIF in WPS Spreadsheets to calculate complete months between two dates in a worksheet.

  1. 1. Open a worksheet: Open WPS Spreadsheets and create a workbook or open an existing Excel file.
  2. 2. Enter the dates: Enter the earlier date in A1 and the later date in B1.
  3. 3. Enter DATEDIF: Select an empty cell, type =DATEDIF(A1,B1,"m"), and press Enter to display the number of complete months.
  4. 4. Save the workbook: Choose File > Save As and select XLSX if you want to keep the workbook in an Excel-compatible format.
Calculate complete months with a single DATEDIF formulaOpen and edit Microsoft Excel XLS and XLSX filesUse a familiar spreadsheet interfaceAccess spreadsheet tools for free
microsoft office alternative - wps office

Frequently Asked Questions

Why can't I find DATEDIF in Excel's function list?

DATEDIF is a compatibility function and may not appear in the function list or Formula AutoComplete. Type it directly into a cell, such as =DATEDIF(A1,B1,"m").

Does DATEDIF count partial months?

No. The "m" unit returns only complete months between the start and end dates.

How can I calculate years or days instead of months?

Replace "m" with "y" for complete years or "d" for total days. For example, use =DATEDIF(A1,B1,"d") to count days.

Why does my DATEDIF formula return an error?

A start date later than the end date returns #NUM!. Unrecognized text instead of a valid date can return #VALUE!. Check the dates in A1 and B1 and confirm the start date is earlier.

Can I use DATEDIF in Excel for Mac?

Yes. Type the formula directly into a worksheet cell, even if DATEDIF does not appear in the function list or Formula AutoComplete.