Templates, guides & honest tool reviews for small business

Sunday, November 29, 2026

Calculate Days Between Two Dates in Excel: DAYS, DATEDIF, NETWORKDAYS

Calculate days between two dates in Excel
Illustration: Calculate days between two dates in Excel

To calculate the days between two dates in Excel, subtract the earlier date from the later one. Excel stores dates as numbers, so a plain subtraction gives the number of days. This guide shows the simple subtraction, the DAYS and DATEDIF functions, how to count only working days with NETWORKDAYS, how to add days to a date and how to fix the common date errors. All dates in the examples are made up.

Excel formula to subtract two dates and get the days between them
Made-up dates (illustration).

Subtract one date from another

If A2 holds the start date and B2 holds the end date:

=B2 - A2

If the result shows as a date instead of a number, change the cell format to General or Number. For 1 November 2026 and 30 November 2026 the answer is 29, because the formula counts the days that pass between the two dates, not including the start day.

The DAYS function

=DAYS(end_date, start_date)

DAYS gives the same result as subtraction. Note the order: the end date comes first.

=DAYS(B2, A2)

Days until a deadline

Use TODAY to count from the current date. If the deadline is in B2:

=B2 - TODAY()

TODAY updates every time the workbook recalculates, so the number changes each day. A negative result means the deadline has passed.

Excel DATEDIF formula to calculate age in years
Units d, m and y (illustration).

Years, months or days with DATEDIF

=DATEDIF(start_date, end_date, unit)

The unit is a letter in quotes:

  • "d" for total days
  • "m" for complete months
  • "y" for complete years

To get the age in years from a birth date in A2:

=DATEDIF(A2, TODAY(), "y")

DATEDIF works, but Excel does not list it in its function suggestions, so you have to type it fully. The start date must be earlier than the end date or you get a #NUM! error.

Excel NETWORKDAYS formula to count working days between dates
Skip weekends and holidays (illustration).

Count working days only

NETWORKDAYS counts Monday to Friday and includes both the start and end dates:

=NETWORKDAYS(A2, B2)

To skip public holidays, list them in a range such as E2:E10 and add it as the third argument:

=NETWORKDAYS(A2, B2, E2:E10)

Some countries have a different weekend, such as Friday and Saturday. In that case use NETWORKDAYS.INTL, which lets you choose the weekend days.

Excel EDATE formula to add months to a date
Add whole months (illustration).

Add days to a date

Add a number to the date:

=A2 + 30

To add whole months, use EDATE:

=EDATE(A2, 3)

This returns the date three months later.

Calculate the sum of values between two dates

If you need totals between a start and an end date, not the number of days, see SUMIFS between two dates. For tracking tasks against dates, our Gantt chart guide uses the same date math.

Fix date errors

  • #VALUE! One of the dates is text. Convert it with DATEVALUE, or retype it.
  • Result looks like a date. Change the format of the result cell to Number.
  • Wrong by one day. Decide whether to count the start day. Add 1 if you want to include it.
  • Negative number. The start date is later than the end date.
  • Different regional format. 05/11/2026 can mean 5 November or 11 May depending on your settings. Check how Excel reads it.

Questions and answers

How do I include the start day in the count?

Add 1 to the result: =B2 - A2 + 1.

Does this work in Google Sheets?

Yes. Subtraction, DAYS, DATEDIF, NETWORKDAYS and EDATE are available in Google Sheets too.

How do I calculate hours between two times?

Subtract the times and format the result as [h]:mm, or multiply the difference by 24 to get decimal hours.

Why does TODAY change when I open the file?

TODAY is volatile and always shows the current date. Type a fixed date if you need it to stay the same.

Summary

Subtract dates for a quick day count, use DATEDIF for years and months, use NETWORKDAYS for working days and format the result cell as a number.

العربية