Calculating Date and Time Differences in Excel

Tap a step below to see it explained in order.

  1. Enter a start date and an end date

    Type the two dates you want to compare into separate cells.

  2. Subtract directly to get the day count

    A formula like =B1-A1 subtracts the start date from the end date to give the number of days between them.

  3. Use DATEDIF for years, months, or days

    Type =DATEDIF(A1,B1,"Y") for full years, "M" for full months, or "D" for total days.

  4. Calculate a time difference

    Subtracting two values that include a time component returns the difference formatted as hours, minutes, and seconds.

  5. Why this is useful

    Great for tracking how long someone has worked somewhere, how long a project has run, or how many days remain until a deadline.

When you need to track tenure or countdowns

Whether you're calculating how long an employee has been with a company, how many days a project has taken, or the days remaining until a deadline, subtracting dates directly or using DATEDIF gives you an exact, always-current answer instead of counting manually.

Watch the cell formatting

Excel sometimes auto-formats a subtraction result as a date rather than a plain number, which can make the answer look bizarre (like a date in the 1900s). If that happens, just change the cell format back to Number or General to see the actual day or time difference.

Frequently Asked Questions

Why doesn't DATEDIF show up in the autocomplete list?

DATEDIF is an undocumented legacy function, so it never appears in the formula autocomplete suggestions β€” but typing it manually still works exactly as expected.

What if my result displays strangely as a date?

Change the cell's number format to "Number" or "General." That converts the display from a date format into the plain day or time count you actually want.