How to Subtract Two Dates in Excel

Last updated on November 9th, 2026 at 01:17 pm

Subtracting one date from another is how you find the number of days between them: how long a project ran, how many days until a deadline, or how old an invoice is. Because Excel stores every date as a serial number (January 1, 1900 is day 1), you can subtract dates just like any other numbers. It is the same minus-sign formula you use to subtract one cell from another in Excel. To turn that day count into years, see how to convert days to years in Excel.

This guide covers the simple subtraction method, then shows how to get the difference in weeks, months, years and working days, how to count from today, and how to handle times and negative results.

How to Subtract Two Dates in Excel

  1. Enter the dates. Type the start date in A2 and the end date in B2, for example 3/1/2026 and 10/9/2026. Excel right-aligns real dates. Left-aligned entries are text and won’t calculate.
  2. Subtract the earlier date from the later one. In C2, type =B2-A2 and press Enter. The result is the number of days between the dates, here 222.
  3. Fix the format if you see a date. Excel sometimes formats the result as a date, so you see something like 8/9/1900 instead of 222. Select the cell and choose General or Number from the Number Format box on the Home tab.
  4. Fill the formula down. Drag the fill handle to apply the formula to every row of dates.

The official reference for these methods is the support article on calculating the difference between two dates.

Other Ways to Get the Difference

Result you wantFormula
Days (same as subtracting)=DAYS(B2,A2)
Weeks=(B2-A2)/7
Complete months=DATEDIF(A2,B2,"m")
Complete years=DATEDIF(A2,B2,"y")
Years as a decimal=YEARFRAC(A2,B2)
Working days (Mon to Fri)=NETWORKDAYS(A2,B2)
Days left after whole months=DATEDIF(A2,B2,"md")

DAYS takes the end date first. DATEDIF needs the start date first and returns #NUM! if it’s later than the end date. Month counts get a fuller treatment in calculating months between two dates in Excel.

Does subtracting dates include both the start and end day?

No. =B2-A2 counts the days in between plus the end day, but not the start day. Add 1 if you need both included. NETWORKDAYS includes both automatically.

Show the Difference in Years, Months and Days

To display a result like “2 years, 3 months, 14 days,” combine three DATEDIF calls:

=DATEDIF(A2,B2,"y")&" years, "&DATEDIF(A2,B2,"ym")&" months, "&DATEDIF(A2,B2,"md")&" days"

The “md” unit can give inaccurate results in some edge cases, especially around month ends, so double-check results that matter.

Count Working Days Only

=NETWORKDAYS(A2,B2) counts weekdays between two dates, including both the start and end dates. Add a range of holiday dates to exclude them: =NETWORKDAYS(A2,B2,H2:H12). If your weekend isn’t Saturday and Sunday, use NETWORKDAYS.INTL, where =NETWORKDAYS.INTL(A2,B2,7) treats Friday and Saturday as the weekend.

Subtract from Today’s Date

  • Days since a date: =TODAY()-A2
  • Days until a deadline: =B2-TODAY()
  • Age in years: =DATEDIF(A2,TODAY(),"y")

These update every day the workbook recalculates, which is ideal for aging reports and countdowns.

Subtract Dates with Times

If the cells contain dates and times, such as 10/9/2026 9:30 AM, subtraction returns days with a fraction for the time. Multiply by 24 for hours: =(B2-A2)*24. To show the result as hours and minutes, format the cell with the custom format [h]:mm. For split date and time columns, business hours and “2 days, 9 hours” style results, see calculating the difference between two dates and times in Excel. For the gap in minutes instead, multiply the same subtraction by 1440, as shown in this guide to calculating minutes between two times.

Handle Negative Results

A negative number means the first date in your formula is later than the second. Swap the cell references, or wrap the formula in ABS to always get a positive count: =ABS(B2-A2). To flag overdue items instead, use =IF(B2<TODAY(),"Overdue",B2-TODAY()).

Tips

  • Leap years are handled automatically, because subtraction counts actual calendar days.
  • Keep start dates in one column and end dates in another so formulas fill cleanly.
  • Adding days instead of subtracting dates? Adding 7 days to a date in Excel shows the formula.
  • To turn a day count into years, try converting days to years in Excel.

#VALUE! or a result that looks like a date

  • #VALUE! error. One of the dates is text. Re-enter it, or convert it with =DATEVALUE(A2). Imported dates often need Data > Text to Columns to convert.
  • The result looks like a date. Change the cell format to General or Number.
  • The cell shows #####. The result is negative and formatted as a date, or the column is too narrow.
  • #NUM! from DATEDIF. The start date is after the end date. Swap them.
  • Dates are off by four years. One workbook uses the 1904 date system. Check File > Options > Advanced.
  • Day and month are swapped. Your data uses a different regional format. Use DATE(year,month,day) to build dates reliably.

Wrapping Up

Type =B2-A2 to get the days between two dates, and format the result as a number if Excel shows a date. Use DATEDIF for months and years, NETWORKDAYS for business days, and TODAY() to count from the current date.

Why don’t I see DATEDIF in the function list?

It’s a hidden compatibility function, so Excel doesn’t suggest it, but it works when you type it.