How to Calculate Days Between Dates in Google Sheets

By Tomosuke Hasegawa · Updated Oct 29, 2026 · Beginner · 6 min read · includes 2 free exercises

In short: Subtract the earlier date from the later one, =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.

AB
1StartEnd
21/10/20263/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

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.

Hint: the end date comes first.

Exercise 2: Use DATEDIF

Write a formula using DATEDIF that returns the total days between A2 and B2.

Hint: the unit code for days is "D".

What to learn next

Syntax and rules in this guide were checked against Google's Days between two dates help page. See all guides.