How to Subtract Two Dates in Excel

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.

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

Step 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.

Step 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.

Step 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.

Step 4: Fill the formula down

Drag the fill handle to apply the formula to every row of dates.

Microsoft covers these methods in its guide to 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–Fri)=NETWORKDAYS(A2,B2)
Days left after whole months=DATEDIF(A2,B2,"md")

Note that DAYS takes the end date first. DATEDIF needs the start date first and returns #NUM! if it’s later than the end date. For more on months, see how to calculate months between two dates in Excel.

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"

Microsoft notes that 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.

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()).

Troubleshooting

  • #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.

Tips

Frequently Asked Questions

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.

Can I subtract dates in months or years?

Yes. Use DATEDIF with “m” for months or “y” for years, or YEARFRAC for a decimal number of years.

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.

Does this work in Google Sheets?

Yes. Subtraction, DAYS, DATEDIF, NETWORKDAYS and YEARFRAC all work the same way.

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.

Get Our Free Newsletter

How-to guides and tech deals

You may opt out at any time.
Read our Privacy Policy