SpreadsheetFormulas
beginnerDATEDIF

Calculate the Days Between Two Dates

You have two date columns — order date and delivery date, invoice sent and invoice paid — and need the number of days between them for every row.

Quick formula
=B2-A2
Sample input
1OrderOrderedDelivered
2ORD-1012026-06-102026-07-08
3ORD-1022026-06-282026-07-05
Result
1OrderDays to Deliver
2ORD-10128
3ORD-1027

Excel & Google Sheets

=B2-A2

This formula works in both Excel and Google Sheets.

How it works

Spreadsheets store every date as a serial number counting days since a fixed start point, so subtracting two dates gives the whole days between them — no function needed. An order placed 10 June and delivered 8 July is simply 28. The result excludes the start date and includes the end date, which is what most people expect for elapsed time. If you prefer an explicit function, =DATEDIF(A2,B2,"D") returns the identical day count and reads more clearly in an audit. Just keep the earlier date in A2: subtracting the wrong way round gives a negative number, and DATEDIF with reversed dates errors with #NUM!.

B2
The later date — delivery, payment, completion.
-A2
Subtracts the earlier date. Dates are numbers, so the result is the day gap.

When to use it

Use it for order-to-delivery time, days from invoice to payment, project duration, or ticket age — any "how long did it take?" question between two recorded dates.

Common mistakes

  • The result shows a date like 1/28/1900 instead of 28.

    The cell inherited date formatting. Switch its number format to General or Number — the math was right all along.

  • One of the dates is text.

    "July 8" typed as text makes the subtraction fail with #VALUE!. Re-enter it as a real date or convert with DATEVALUE.

  • Expecting business days.

    Plain subtraction counts every calendar day, weekends included. For working days only, use =NETWORKDAYS(A2,B2) instead.

Did this formula help?

Engine-verified against the sample data aboveDownload the proof sheet (.xlsx)Last reviewed 2026-07-09