How to Calculate Days Between Dates in Google Sheets
=B2-A2, or use =DAYS(B2, A2) (end date first) or =DATEDIF(A2, B2, "D"). All three count the days between the dates.
The example
Here are a start date and an end date in cells A1:B2.
| A | B | |
|---|---|---|
| 1 | Start | End |
| 2 | 1/10/2026 | 3/15/2026 |
Dates in the tables are shown in month/day/year order. The results do not depend on your display format.
Way 1: subtract the dates
Dates are stored as numbers, with one unit per day, so subtraction works:
=B2 - A2
This returns 64: 21 days left in January after the 10th, plus 28 days in February, plus 15 in March. If the result shows up as a date, change the cell's format to a plain number.
Way 2: the DAYS function
DAYS makes the intent clearer:
=DAYS(B2, A2)
This also returns 64. Note the order: Google's help page gives the syntax as DAYS(end_date, start_date), with the end date first. This is the opposite of most functions, so it is the usual source of negative results. The page says DAYS accounts for leap days. Its second example lists the dates in an order that seems to disagree with the syntax, so check the sign of your own results.
Way 3: DATEDIF with "D"
DATEDIF takes the start date first and a unit code last. With the unit "D" it returns the total days between the two dates:
=DATEDIF(A2, B2, "D")
This also returns 64. The unit codes "M" (whole months) and "Y" (whole years) are covered in the DATEDIF guide.
Working days instead of calendar days
To skip weekends, use NETWORKDAYS.
Common mistakes
- Dates stored as text. A date that is left-aligned in its cell may be text. Subtraction then fails.
- The wrong order in DAYS. The end date goes first.
- The result shows as a date. Set the cell format to Number.
- Expecting inclusive counts. Subtraction gives the gap. If you want to count both the first and last day, add 1.
Try it yourself
Use the dates above (A2 and B2). Type your formula into the box, starting with =, then press Check.
Exercise 1: Use DAYS
Write a formula using DAYS that returns the number of days between the start date in A2 and the end date in B2.
Exercise 2: Use DATEDIF
Write a formula using DATEDIF that returns the total days between A2 and B2.
What to learn next
- DATEDIF: whole years, months or days between dates.
- NETWORKDAYS: count working days between two dates.
- TODAY: return the current date.
Syntax and rules in this guide were checked against Google's Days between two dates help page. See all guides.