How to count the days between two dates in Excel

Excel stores a date as a number, which means the gap between two dates is plain subtraction. No function is needed.

The formula

=B2-A2 in column C

What each part does

B2-A2
The later date minus the earlier one. Excel stores dates as numbers, so plain subtraction works.
Ordered first
Put the earlier date second, or the answer comes out negative.

How it works, and what to watch for

This uses plain subtraction, not a function. Excel stores each date as a number, so the later date minus the earlier one gives the number of days. There is a DAYS function too, but for a simple gap the minus sign is shorter and does the same job.

Put the dates the other way round and the answer comes out negative, so keep the later date first.

The answer sometimes appears as a date rather than a number, because the cell has picked up the format of the cells it came from. Setting the cell back to General or Number fixes it.

This count includes every day, weekends and holidays alike. For working days only, NETWORKDAYS is the one to use.

If either cell holds a date typed as text, the sum returns an error or a strange number. A date that sits on the left of its cell is usually text; DATEVALUE turns it into a real date.

Questions

Why does my date subtraction show a date?

The cell is formatted as a date. Change the format to General or Number and the day count appears.

How do I count only working days?

Use =NETWORKDAYS(A2,B2), which leaves out Saturdays and Sundays, and any holidays you list.

Can I get months or years instead?

Yes, with DATEDIF. Use "m" for whole months and "y" for whole years.

The example sheet

Ordered Delivered Days taken
2026-03-02 2026-03-09
2026-03-04 2026-03-05
2026-03-06 2026-03-20
2026-03-10 2026-03-11

If this helped, these are close by

More on Date subtraction, and every walkthrough that uses it.

Settings: separator, Excel version

Argument separator

Set by your computer's language, not by the file. A frequent cause of a correct-looking formula being rejected.

Excel version

XLOOKUP, IFS, TEXTBEFORE and TEXTJOIN need Microsoft 365 or 2021; older versions return #NAME? instead. Choosing the older one switches every walkthrough to a formula that works there.