Excel DAYS function: calculate the days between two dates
If A2 contains the start date and B2 contains the end date, use DAYS(B2,A2) to calculate the number of days between them. January 1 to January 15, 2018 is a difference of 14 days. Counting both dates gives 15 days.
Enter the dates and calculate the difference
Put the end date first and the start date second. Enter the first two formulas below in A2 and B2 to create actual dates, then enter the third in C2. C2 shows 14. Reversing the arguments gives -14.
=DATE(2018,1,1)
=DATE(2018,1,15)
=DAYS(B2,A2)
You can also use DATE to specify the year, month, and day directly inside a formula. The example below also returns 14. If Excel rejects the argument separator, use the list separator for your regional settings.
=DAYS(DATE(2018,1,15),DATE(2018,1,1))
Microsoft’s DAYS function reference
Microsoft’s DATE function reference
Count both the start and end dates
January 1 and January 2 are one day apart. Counting each calendar date gives two days. Use the formula below when the end date is on or after the start date and both values are dates without times. It gives 15 in this example and 1 when both dates are the same.
=DAYS(B2,A2)+1
Choose the calculation to match your purpose. For example, checking in on January 1 and out on January 15 is a stay of 14 nights. An event that includes both January 1 and January 15 runs for 15 calendar days.
Fix a date display or an error
If the result displays as a date instead of 14, format that cell as General or Number. If you see #VALUE!, check whether either input is text that Excel cannot parse. A string such as 01/02/2018 can mean different dates in different regions. Confirm the intended year, month, and day and use DATE to make the date explicit.
Subtracting two numeric date-time values can return a fraction of a day. For example, the interval from 8 a.m. to 8 p.m. on the same day is 0.5 days. If you need only the calendar dates, remove the time components before calculating.
Exclude weekends and holidays
DAYS gives the difference in calendar days, including weekends and holidays. Use NETWORKDAYS if you need to exclude Saturdays, Sundays, and specified holidays. That function counts each endpoint if it is a working day, so it uses different rules from a simple date difference.




