SheetSense

Days between two dates with DAYS

DAYS returns the number of days from a start date to an end date, and it takes the end date first, which is the argument order people most often get backwards.

fx
=DAYS(B2,A2)

The sheet: Projects sheet: column A is Start date and column B is End date. You want the number of days between them in column C.

How it works, step by step

  1. 01A2 holds the start date, for example 2026-03-01, and B2 holds the end date, for example 2026-03-29.
  2. 02DAYS(B2,A2) subtracts the start from the end. The end date goes first.
  3. 03The result is 28, the number of days between the two dates, not counting the start day itself.
  4. 04Format the cell as General or Number. If it shows as a date, the formula is correct but the formatting is not.

The same logic in four tools

Excel
=DAYS(B2,A2)
Google Sheets
=DAYS(B2,A2)
SQL
-- PostgreSQL: date minus date gives whole days.
SELECT end_date - start_date AS days_between FROM projects;
-- MySQL / SQL Server:
-- DATEDIFF(end_date, start_date)  /  DATEDIFF(day, start_date, end_date)
Python (pandas)
import pandas as pd

projects["start_date"] = pd.to_datetime(projects["start_date"])
projects["end_date"] = pd.to_datetime(projects["end_date"])
projects["days_between"] = (projects["end_date"] - projects["start_date"]).dt.days

Mistakes that break it

  • !Dates stored as text return #VALUE!. Check with =ISNUMBER(A2). A real date is a number, and left-aligned dates are usually text.
  • !If the cells include a time of day, the result has a fraction, such as 28.5. Wrap the dates in INT() for whole days.
  • !The order matters. DAYS(A2,B2) gives a negative number when the start is earlier than the end.
  • !DAYS counts calendar days. For working days only, use NETWORKDAYS, and for whole months or years use DATEDIF.

Common questions

How do I calculate the number of days between two dates in Excel?
Subtract the earlier date from the later one, =B2-A2, or use =DAYS(B2,A2). Both return the same whole number when the cells contain no times.
Does DAYS include the start date?
No. From March 1 to March 2, DAYS returns 1. Add 1 if you want to count both the first and the last day.
How do I get days between dates in Python?
Convert both columns with pd.to_datetime, subtract them, and read .dt.days from the result.

Got a version of this with your own ranges?

Paste it into the free translator and get the same breakdown for your exact formula. To run it against a real file, upload the CSV and describe the formula you need in a sentence.