Skip to main content

Date formula page

Days Between Dates Formula

Use date subtraction when both cells contain real spreadsheet dates and you want elapsed calendar days.

Best for

Calculate days between dates in Excel or Google Sheets.

What it returns

If A2 is 2026-01-01 and B2 is 2026-01-31, the result is 30.

Copy formulas

Excel formula
=B2-A2
Google Sheets formula
=B2-A2
Excel / Google Sheets difference

Simple subtraction returns elapsed calendar days and excludes the start date; add 1 when the report needs both endpoints included.

Example data

Start DateEnd DateHolidayResult
2026-01-012026-01-312026-01-1930
2026-02-102026-03-1230
1990-05-202026-05-2036
What it returns

If A2 is 2026-01-01 and B2 is 2026-01-31, the result is 30.

How the formula works

  • Spreadsheet dates are stored as serial numbers.
  • Subtracting start from end returns elapsed days.
  • Add 1 only when your business rule counts both endpoints.
Syntax pieceRole in the formula
A2The start date stored as a spreadsheet date serial.
B2The end date stored as a spreadsheet date serial.
B2-A2The end-date-minus-start-date calculation for elapsed days.
+1The optional adjustment that includes both the start and end dates.

Verified examples

Elapsed January days
=B2-A2

Excel: Enter 2026-01-01 in A2 and 2026-01-31 in B2 as real dates. Returns: 30

Inclusive January days
=B2-A2+1

Google Sheets: Use the same start and end dates in A2 and B2. Returns: 31

Reversed date order
=B2-A2

Excel: Enter 2026-01-31 in A2 and 2026-01-01 in B2. Returns: -30

Common errors and fixes

IssueLikely causeFix
The formula returns #VALUE!One or both inputs are text that the spreadsheet cannot parse as dates.Convert the inputs to real date values and check the locale-specific date format.
The result displays as a dateThe result cell has date formatting instead of number formatting.Format the result as General or Number to show the day count.
The result contains decimalsOne or both cells include time values in addition to the dates.Wrap the inputs with INT when time-of-day precision is not wanted.

When not to use this formula

  • Do not use simple subtraction when weekends, holidays, or business-day rules must be excluded; use a workday function instead.

Alternatives

AlternativeWhen to use it
Workdays Between Dates FormulaUse when weekends or listed holidays should be excluded.
Date Difference Formula BuilderUse when the date difference needs guided unit and boundary choices.

Related formulas

Official references

FAQ

Does simple subtraction include both dates?

No. B2-A2 measures elapsed days between the dates; add 1 to count both endpoints.

What does a negative result mean?

It means the end date in B2 occurs before the start date in A2.