Excel date formula

Days between two dates, add working days, find month end, and the reason your date turned into a five-digit number.

Free, no signup, nothing to download. Results update as you type.

The formula
=B2-A2

That gives the number of days between two dates. Format the result cell as a Number, not a Date, or it shows a date in 1900 instead of a count.

How to do it
  1. 1Click the cell where the number of days should appear.
  2. 2Type = then the later date cell, then - then the earlier one, and press Enter.
  3. 3If it shows something like 05/01/1900, set the cell format to Number.
  4. 4For working days only, use =NETWORKDAYS(A2, B2), which excludes weekends and counts both ends.
Days between=B2-A2Format the result cell as a Number, not a Date, or it shows a date in 1900.
Working days between=NETWORKDAYS(A2, B2, $H$2:$H$20)Counts both endpoints and excludes weekends, plus any holidays you supply.
Add 10 working days=WORKDAY(A2, 10, $H$2:$H$20)
End of that month=EOMONTH(A2, 0)Use 1 for the end of next month, -1 for last month.
Loading the live sheet…
How this is calculated

A date is stored as a number of days since 1900, which is why subtracting two dates gives a plain count and why a difference formatted as a Date shows something absurd. NETWORKDAYS counts working days inclusive of both ends; WORKDAY moves forward by working days; EOMONTH jumps to a month end.

Frequently asked
Why did my date turn into a five-digit number?

Because that is what a date actually is. Excel stores dates as days since 1900, so 45000 is a real date wearing the wrong format. Set the cell format to Date and it comes back, with nothing lost.

Why is my days-between one lower than I expect?

Plain subtraction counts the gap, not the days involved. From Monday to Friday is 4 by subtraction and 5 working days by NETWORKDAYS, which counts both endpoints. Decide which one your business means before reporting it.

How do I exclude holidays?

Put them in a column and pass that range as the last argument to NETWORKDAYS or WORKDAY. Lock it with dollar signs so it does not drift when the formula fills down.

Stop recalculating this by hand.

The same numbers, live off the rows your team already edits, in a spreadsheet that rolls them up for you. Start your 7-day free trial, no credit card required.