What the video covers
Shows how to calculate whole-month counts using DATEDIF and how to produce fractional month values with YEARFRAC. Assumes dates are in worksheet cells and formatted as dates.
Watch the video on YouTubeStep-by-step instructions
- Prepare your date cells
Put the earlier date in one cell (example A2) and the later date in another (example B2). Make sure both cells are formatted as dates. - Calculate whole completed months with DATEDIF
In the cell where you want the month count, enter: =DATEDIF(A2, B2, "M"). Press Enter. This returns the count of fully completed calendar months between the two dates. - Fill the formula down a column
If you have many rows, use the fill handle: select the result cell and double-click or drag the fill handle to copy the formula down your column. - Interpret the DATEDIF result
DATEDIF with the "M" unit counts only whole months. Example: 2023-01-15 to 2023-02-14 yields 0 because the final month was not completed. - Get fractional (decimal) months when needed
To express partial months as decimals, use: =YEARFRAC(A2, B2) * 12. This returns the total duration in months including fractions. - Fix common errors
If you see #NUM!, swap the start and end dates so the earlier date is the first argument. If results look wrong, confirm cells contain real date values (not text) and are in the expected chronological order.
Watch the video
Play tutorial
Why it matters
Counting only fully completed calendar months avoids off-by-one errors in schedules and financial reports. For more granular metrics, fractional months express partial-month durations as decimals.
Check your result
Result is an integer when using DATEDIF with "M" (number of fully completed months). YEARFRAC multiplied by 12 gives a decimal month count. If the result seems wrong, verify cell formats and date order.
Troubleshooting
If you get #NUM!, the start date is later than the end date—swap the arguments so the earlier date is first. DATEDIF does not provide autocomplete in Excel; type the function and arguments exactly. Ensure cells are real date values, not text.