Skip to main content

Formula example

Calculate Days Between Dates Formula Example

Calculate elapsed calendar days between a start date in A2 and an end date in B2. From 2026-01-01 to 2026-01-31, the formula returns 30.

Copyable formula

Excel and Google Sheets formula
=B2-A2
What it returns

Returns 30 for 2026-01-01 through 2026-01-31 because it counts elapsed days between the dates.

Useful variations

Elapsed calendar days
=B2-A2

Counts the number of day boundaries between the start and end dates.

Inclusive calendar days
=B2-A2+1

Use this when both the start date and end date should be counted.

Always return a positive number
=ABS(B2-A2)

Use this when the input order may be reversed and you only need the distance between dates.

Business days
=NETWORKDAYS(A2,B2)

Counts weekdays and excludes weekends. Excel and Google Sheets also support an optional holiday range.

Sample data

Start DateEnd DateDays
2026-01-012026-01-3130
2026-02-102026-03-1230
2026-04-152026-05-0116

When to use this formula

  • You need elapsed calendar days between two real spreadsheet dates.
  • The result should update when either date cell changes.
  • You want a simple formula before moving to business days, months, or age calculations.

Elapsed days versus inclusive days

B2-A2 returns elapsed days. If the start date and end date should both count as part of a booking, rental, or coverage period, use B2-A2+1 instead.

Excel and Google Sheets behavior

Both Excel and Google Sheets store dates as serial numbers, so subtracting two real date cells works the same way. If a date is stored as text, convert it before subtracting.

When to use NETWORKDAYS

Use NETWORKDAYS when weekends should not count. Add a holiday range as the third argument when company holidays or public holidays should also be excluded.

Returned days from the sample data

Start dateEnd dateElapsed days
2026-01-012026-01-3130
2026-02-102026-03-1230
2026-04-152026-05-0116

Date difference choices

NeedFormulaResult behavior
Elapsed days=B2-A2Counts days between the two dates.
Inclusive days=B2-A2+1Counts both the start and end dates.
Positive difference=ABS(B2-A2)Avoids negative results when dates are reversed.
Business days=NETWORKDAYS(A2,B2)Counts weekdays instead of all calendar days.

Formula explanation

  • Spreadsheet dates are stored as serial numbers.
  • Subtracting the start date from the end date returns elapsed calendar days.
  • For completed months or years, use DATEDIF instead.

Common errors

  • Date-looking text may not subtract correctly.
  • A negative result means the end date is earlier than the start date.
  • If cells include times, decimals may appear in the result.
  • Use +1 only when your workflow needs inclusive date counting.

Build your own version

Use the formula builder for this pattern: Date Difference Formula Builder.

Related formulas

FAQ

Should I add one day for inclusive counting?

If both start and end dates should be counted, use =B2-A2+1.

Can this show business days?

Yes. Use NETWORKDAYS(A2,B2) for weekday counts, and add a holiday range if holidays should be excluded.

Why does the result show a decimal?

One or both cells likely include a time value. Format the result as a number or strip the time from the source date cells.

Does the same formula work in Google Sheets?

Yes. Subtracting two real date cells works the same in Excel and Google Sheets.