Main content

Calculate the Difference Between Dates in Excel

By Szabó Gergő · Updated

Excel stores dates as serial numbers, so simple subtraction returns elapsed days. DATEDIF calculates completed units, while NETWORKDAYS counts working days.

Syntax and arguments

=end_date-start_date  or  =DATEDIF(start_date,end_date,"unit")
start_date
The earlier valid Excel date.
end_date
The later valid Excel date.
unit
For DATEDIF: "d" for days, "m" for complete months, or "y" for complete years.

Date difference examples

01
Count elapsed days

Start date is A2 and end date is B2.

=B2-A2

Format the result as General or Number to display the count of days.

02
Count complete months

A subscription begins in A2 and ends in B2.

=DATEDIF(A2,B2,"m")

Only fully completed months are counted.

03
Count working days

Start and end dates are A2 and B2; holidays are listed in H2:H20.

=NETWORKDAYS(A2,B2,$H$2:$H$20)

Weekends and listed holidays are excluded; both endpoints are included when they are workdays.

Common mistakes

  • Result displays as a date

    Change the result cell format to General or Number.

  • Dates are actually text

    Convert imported text with DATEVALUE or the Text to Columns tool before calculating.

  • DATEDIF returns #NUM!

    Ensure the start date is not later than the end date.

Date difference FAQ

How do I include both the start and end date?

For calendar days, add 1 to end_date-start_date. Decide whether inclusive counting matches your business rule.

How do I calculate age in years?

Use DATEDIF(birth_date,TODAY(),"y") to return completed years.

Does NETWORKDAYS include holidays?

It excludes holidays only when you supply a holiday range as the optional third argument.