ExcelReady
CourseFunction guidesBlog
Start freeStart learning for free
ExcelReady

Be Excel-ready before the interview. Hands-on practice in your browser, with instant feedback.

Learn

  • Course
  • Function guides
  • Blog

Product

  • Certificate

Company

  • Editorial policy
  • Contact
  • Terms
  • Privacy

© 2026 ExcelReady. All rights reserved.

  1. Blog
  2. Comparisons
  3. DAYS vs DATEDIF vs Subtracting Dates in Excel

DAYS vs DATEDIF vs Subtracting Dates in Excel

By ExcelReady Team·Updated October 30, 2026·7 min read

The short answer

To count days, subtracting dates (=C2-B2) and DAYS(end, start) give the same answer. Use DATEDIF(start, end, unit) when you need complete years or months, such as tenure or age. Watch the order: DAYS takes the end date first, DATEDIF takes the start date first, and DATEDIF returns #NUM! if the start is later.

Key takeaways

  • =C2-B2 and =DAYS(C2,B2) return the same number of days.
  • DAYS takes the end date first; DATEDIF takes the start date first.
  • Only DATEDIF counts complete years ("Y") and months ("M"), plus leftovers like "YM".
  • Subtraction and DAYS return negative numbers if the dates are reversed; DATEDIF returns #NUM!.
  • None of them counts both end dates; add 1 if you need an inclusive count.
On this page+
  1. DAYS vs DATEDIF vs subtraction at a glance
  2. Why subtracting dates works
  3. How DAYS works
  4. How DATEDIF works
  5. The same dates, side by side
  6. What happens when a date is missing?
  7. When to use subtraction or DAYS
  8. When to use DATEDIF
  9. Common mistakes with DAYS and DATEDIF
  10. Our recommendation
  11. Practise it

DAYS vs DATEDIF vs simple subtraction is a common source of confusion, because all three can count the days between two dates. Subtracting (=C2-B2) and DAYS (=DAYS(C2,B2)) always give the same number of days. DATEDIF is the one to use when you need complete years or months, such as tenure, age or contract length. This guide is for anyone in HR, admin or finance who works with hire dates, deadlines or birthdays and wants the right formula the first time.

DAYS vs DATEDIF vs subtraction at a glance#

Subtraction and DAYS count days only; DATEDIF counts days, months or years.

Feature=end-startDAYSDATEDIF
Syntax=C2-B2=DAYS(end_date, start_date)=DATEDIF(start_date, end_date, unit)
Argument orderLater date firstEnd date firstStart date first
Counts daysYesYesYes ("D")
Complete months or yearsNoNoYes ("M", "Y")
Leftover months or daysNoNoYes ("YM", "MD", "YD")
Dates the wrong way roundNegative numberNegative number#NUM! error
Shown in autocompleten/aYesNo, type it in full
Excel versionsAllExcel 2013 and laterAll

Why subtracting dates works#

Subtraction works because Excel stores every date as a whole number: the number of days since a fixed starting point. In the default Windows date system, 1 January 1900 is day 1 and 1 January 2025 is day 45658. Subtracting one date from another simply subtracts those numbers, which gives the days between them. Our guide to why Excel stores dates as numbers explains the details.

One display quirk: the result cell sometimes takes on a date format and shows something like 12/5/1907. The number underneath is right. Change the cell's format to General or Number (Windows: Ctrl+Shift+~; or use Home > Number Format) to see the days.

How DAYS works#

DAYS does exactly what subtraction does, written as a function:

Excel formula
=DAYS(end_date, start_date)

The end date comes first, just like in =end-start. If you put the earlier date first, you get a negative number rather than an error. The main reason to use DAYS is readability: a colleague sees at once that the formula counts days between two dates. Our guide to days between two dates has more examples.

How DATEDIF works#

DATEDIF counts the gap between two dates in the unit you choose:

Excel formula
=DATEDIF(start_date, end_date, unit)

The start date comes first, the opposite of DAYS. The unit is a code in double quotes:

UnitReturns
"Y"Complete years
"M"Complete months
"D"Days (same as subtraction)
"YM"Months left over after complete years
"MD"Days left over after complete months
"YD"Days left over after complete years

DATEDIF doesn't appear in Excel's autocomplete list, because Microsoft keeps it mainly for compatibility with older spreadsheets. It still works in every version; you just have to type the whole name. Microsoft's own documentation warns that the "MD" unit can give inaccurate results in some cases, so check any formula that relies on it. The DATEDIF function guide covers each unit.

The same dates, side by side#

Here is one employee's record. The task: how long between hire and last review?

ABC
1EmployeeHire dateLast review
2Jordan Price11 Apr 201615 Mar 2024
QuestionFormulaResult
Days, by subtraction=C2-B22,895
Days, with DAYS=DAYS(C2,B2)2,895
Days, with DATEDIF=DATEDIF(B2,C2,"D")2,895
Complete years=DATEDIF(B2,C2,"Y")7
Complete months=DATEDIF(B2,C2,"M")95
Months after the full years=DATEDIF(B2,C2,"YM")11
Days after the full months=DATEDIF(B2,C2,"MD")4
Dates reversed with DAYS=DAYS(B2,C2)-2,895
Dates reversed with DATEDIF=DATEDIF(C2,B2,"Y")#NUM!

Put the pieces together for a tenure label like 7 yrs, 11 mos:

Excel formula
=DATEDIF(B2,C2,"Y")&" yrs, "&DATEDIF(B2,C2,"YM")&" mos"

For tenure up to today, replace C2 with TODAY(). Our guide on calculating age or years of service covers that version step by step.

What happens when a date is missing?#

Real lists often have gaps, such as an employee who hasn't had a review yet. The three methods fail in different ways when the end date is blank, because Excel treats an empty cell as 0, the very start of its date system:

Formula with C2 emptyResult
=C2-B2-42,471 (a large negative number)
=DAYS(C2,B2)-42,471
=DATEDIF(B2,C2,"Y")#NUM!

None of these is useful in a report. Check for the blank first and show nothing instead:

Excel formula
=IF(C2="","",DATEDIF(B2,C2,"Y"))

The same pattern works with subtraction or DAYS. If you need a decimal number of years instead of whole ones, such as 7.93 years of service, use YEARFRAC; our guide to YEARFRAC in Excel explains its basis options.

When to use subtraction or DAYS#

Use subtraction or DAYS whenever the answer is a number of days. They are the better choice when:

  • You count days until a deadline or days since an invoice was sent.
  • You compare against a day limit, such as =IF(C2-B2>30,"Overdue","OK").
  • You want a negative result to mean "in the future" rather than an error.
  • The formula must be easy for anyone to read. Pick one style and use it across the workbook.

If the question is about working days, neither is right: weekends count as days. Use NETWORKDAYS instead, as explained in our comparison of NETWORKDAYS vs WORKDAY.

When to use DATEDIF#

Use DATEDIF when the answer must be in whole months or years. It is the better choice when:

  • You calculate tenure or length of service for HR reports. This comes up constantly in Excel skills for HR and recruiting jobs.
  • You calculate age from a date of birth.
  • You need "X years, Y months" labels.
  • You check eligibility rules, such as "at least 6 complete months of service".

Dividing days by 365 is a common shortcut, but it drifts because of leap years. For a decimal number of years, use YEARFRAC instead; for whole years, use DATEDIF.

Common mistakes with DAYS and DATEDIF#

These slips cause most wrong date results:

  1. Swapping the argument order between functions. DAYS is end, start. DATEDIF is start, end. Read the formula aloud before you press Enter.
  2. Forgetting the quotes around the unit. =DATEDIF(B2,C2,Y) gives #NAME?; it must be "Y".
  3. Dates stored as text. A date typed as text, such as one imported from another system, may not calculate. Check that the cell is right-aligned by default, or test it with =ISNUMBER(B2).
  4. Expecting an inclusive count. All three methods count the gap. Add 1 if both the first and last day should count.
  5. Dividing by 365 for years. Use DATEDIF with "Y" for whole years.
  6. Relying on "MD" without checking. Test it against a few dates you can count by hand.

Getting the argument order right is the same kind of detail that trips people up in our comparison of MATCH types 0, 1 and -1.

Our recommendation#

Use subtraction or DAYS for days, and DATEDIF for whole months and years. Subtraction is the shortest and works everywhere, while DAYS reads more clearly in a shared workbook; pick one and stay consistent. Reach for DATEDIF whenever the answer must be in complete months or years, and always put the earlier date first.

In short: days with =end-start or DAYS, months and years with DATEDIF.

Practise it#

Try the DATEDIF months exercise on this page, then open the days between dates lesson. It takes you from plain subtraction to DAYS, then DATEDIF with "Y", "M" and "YM", and finishes with a "7 yrs, 11 mos" tenure label built from the pieces.

Try it yourself

This is a live spreadsheet. Type the formula in the green cell and press Enter.

HR wants tenure in complete months. In D2, use DATEDIF to count the full months from the hire date in B2 to the last review in C2. Remember: the start date comes first, and the unit is "M" in double quotes.

fx
ABCDE
1
Employee
Hire date
Last review
Months
2
Jordan Price
42471
45366
3
Mei Chen
43710
45366
4
Sam Okafor
44578
45366
5
6
7

Tip: DATEDIF takes the start date, the end date, then the unit: =DATEDIF(B2,C2,"M").

Practise this in a lesson

LessonDays between dates: DAYS, DATEDIF and TODAYMeasure the gap between two dates in days, months and years, and calculate tenure as of today.Function guideDATEDIFCalculate tenure, age and contract length with DATEDIF. Learn every unit (Y, M, D, YM), the hidden-function quirks, and practice live.

Frequently asked questions

What is the difference between DAYS and DATEDIF?

+

DAYS returns only the number of days between two dates, with the end date first. DATEDIF takes the start date first and a unit, so it can return complete years, complete months or days.

Is it better to subtract dates or use DAYS?

+

They give the same result. Subtraction is shorter and works in every version; DAYS makes the intent clearer to someone reading the formula and is available in Excel 2013 and later.

Why doesn't Excel suggest DATEDIF when I type it?

+

DATEDIF is an older function that Excel keeps for compatibility, so it doesn't appear in the formula autocomplete list. It still works: type the whole name and its arguments.

Why does DATEDIF return #NUM!?

+

The start date is later than the end date. Swap the first two arguments so the earlier date comes first.

How do I count days including both the start and end date?

+

Add 1: =C2-B2+1 or =DAYS(C2,B2)+1. Both normally count the gap between the dates, so 1 March to 3 March is 2 days, or 3 days with the +1.

Sources

  • DATEDIF function - Microsoft Support
  • DAYS function - Microsoft Support
  • Date systems in Excel - Microsoft Support

Written and checked by the ExcelReady Team. First published October 30, 2026. The practice exercise runs in the same formula engine as our lessons. Found a mistake? Read our editorial policy or email hello@excelready.app.

On this page

  1. DAYS vs DATEDIF vs subtraction at a glance
  2. Why subtracting dates works
  3. How DAYS works
  4. How DATEDIF works
  5. The same dates, side by side
  6. What happens when a date is missing?
  7. When to use subtraction or DAYS
  8. When to use DATEDIF
  9. Common mistakes with DAYS and DATEDIF
  10. Our recommendation
  11. Practise it

Keep reading

Comparisons· 7 min read

NETWORKDAYS vs WORKDAY in Excel

NETWORKDAYS answers "how many working days between these two dates?" and returns a number. WORKDAY answers "which date is N working days from this one?" and returns a date. Both skip Saturdays, Sundays and an optional holiday list. NETWORKDAYS counts the start and end days; WORKDAY does not count the start day.

Comparisons· 8 min read

MATCH Type 0 vs 1 vs -1 Explained

MATCH's third argument decides how it matches. 0 finds an exact match in any order. 1, the default, finds the largest value less than or equal to the lookup value and needs the list sorted smallest to largest. -1 finds the smallest value greater than or equal to it and needs the list sorted largest to smallest.

Tests & careers· 5 min read

Excel Skills for HR and Recruiting Jobs

The most useful Excel skills for HR and recruiting are counting headcount with COUNTIFS, totalling payroll with SUMIFS, calculating tenure and time to hire with DATEDIF, TODAY and date subtraction, looking up employee records with XLOOKUP or VLOOKUP, flagging eligibility with IF and AND, and cleaning names and dates so reports stay accurate.

Don't just read about Excel. Do it.

Practise real formulas in a live spreadsheet with instant feedback. The first lessons are free, with no download.

Start learning for free