Spreadsheet Practice

How to calculate the number of days between two dates in Excel

Formula (Excel and Google Sheets)

=C2-B2

Subtract the earlier date from the later one: =C2-B2. Dates are numbers of days, so the difference is the number of days.

Result on the example
one result per row in D2, filled down to D5
Works in
Excel 2013 and later
Google Sheets
Same formula

See it work

The formula is already in D2, filled down to D5. Change any input and the result updates, or edit the formula to experiment.

How it works

Spreadsheets store a date as the number of days since a starting point, so subtracting one date from another gives the days between them. Format the result as a number: if it inherits the date format it shows as a strange date like 2/22/1900.

=C2-B2

Result53

  1. C23/6/2026

    The value in C2.

  2. B21/12/2026

    The value in B2.

  3. C2-B253

    The - operator subtracts.

In Google Sheets

The same formula works in Google Sheets: =C2-B2. We ran it in Google Sheets mode on the same data and it returns the same results.

Other ways to do it

Each one was run on the same example sheet.

FormulaResultWhen to use it
=DAYS(C2,B2)53, 25, 18…The same result. Note the order: end date first.
=C2-B2+154, 26, 19…Different resultAdd 1 when both the start and end days count, like a hotel stay or an event. One more day: both ends are counted.
=NETWORKDAYS(B2,C2)40, 20, 15…Different resultCounts working days (Monday to Friday) instead, including both ends. Weekdays only.

Common mistakes

  • Dates stored as text (left-aligned) give #VALUE!. Convert them with DATEVALUE or by retyping.
  • A negative result means the dates are the wrong way round. Wrap in ABS if order doesn't matter.
  • DATEDIF(B2,C2,"d") also works but is undocumented in Excel, so it doesn't appear in autocomplete.

Try it yourself

Same data, empty answer cell. Your formula is graded instantly, then re-checked on changed data, so a typed-in number won't pass.

Calculate the number of days between two dates

In D2, calculate how many days each project ran from start to end, and fill down to D5.

Questions

How do I calculate days from a date until today?

Use =TODAY()-B2. It updates every day.

How do I get the difference in months or years?

Use =DATEDIF(B2,C2,"m") for whole months or "y" for whole years.

Checked by running on 2026-10-29: every formula and result on this page was calculated by the Spreadsheet Practice formula engine, in both Excel and Google Sheets modes.