To find the number of days between two dates in Excel, subtract the earlier date from the later one. With the start date in A2 and the end date in B2, enter =B2-A2; for example, January 10 to January 15 returns 5 days. If you need to count both dates, calculate an inclusive count instead.
Calculate the basic calendar-day difference
Excel treats valid dates as numbers, so subtraction is the simplest way to get the elapsed calendar days between them. Put the earlier date in A2 and the later date in B2, then enter =B2-A2 in another cell. If A2 contains 1/10/2025 and B2 contains 1/15/2025, the result is 5. The calculation counts the change from the start date to the end date, not both dates as separate days.
Enter the dates as recognizable Excel dates, not as text that merely looks like a date. Depending on your regional settings, Excel may interpret 1/10/2025 as January 10 or October 1. To avoid ambiguity, type dates in a format Excel recognizes for your settings or use a four-digit year and a clear month name. You can check a result by selecting its cell and viewing the formula bar.
If the result appears as another date rather than a number, the formula cell may have a date number format. Select it and choose Home > Number format dropdown > Number, or use General. A result of 5 means five elapsed days. Formatting changes how the result is displayed; it does not change the underlying subtraction.
Why subtracting dates works
Excel stores dates as serial numbers: each date corresponds to a number that advances by one for each calendar day. That makes a date subtraction equivalent to subtracting two numbers. You do not need to convert ordinary Excel dates to serial numbers yourself. The date format makes the serial value readable as a calendar date, while the subtraction returns the difference between the values.
This also explains why a date difference can be negative. If B2 is earlier than A2, =B2-A2 returns a negative number. For example, subtracting January 15 from January 10 in that order gives -5. A negative result is not automatically an error; it may indicate that the dates are reversed. Excel workbooks can also use different date systems, so dates copied between certain older or specially configured workbooks may need checking if they shift unexpectedly.
Count both the start and end dates
Subtracting dates measures the distance between them. It does not count both endpoints as days included in a schedule. If a project runs from January 10 through January 15 and both January 10 and January 15 are working or covered dates, that period contains six calendar dates, even though the subtraction returns 5.
With the start date in A2 and the end date in B2, use =B2-A2+1 when both endpoints should be included. For January 10 through January 15, the result is 6. This convention is useful for booking periods, date ranges in reports, and counting days of coverage. It is not a universal rule: for measuring elapsed time, age in days, or the gap between two events, the non-inclusive subtraction is usually the relevant measure.
For a same-day range, subtraction returns 0, while an inclusive count returns 1. Decide whether your question is about the gap between dates or the number of dates covered before choosing the calculation.
Handle dates entered in reverse order
If users may enter either date first, choose whether the answer should show a negative value or always be positive. Keeping the subtraction in a fixed direction is helpful when a negative value should flag an incorrectly ordered range. If you only need the size of the gap, use the absolute difference.
With the two dates in A2 and B2, enter =ABS(B2-A2) to return a nonnegative number of days regardless of their order. For example, dates five days apart return 5 whichever date is in A2. This approach hides the direction, however, so it is less appropriate when you need to identify whether a deadline is before or after a reference date.
Count weekdays or working days
For a business-day count that excludes Saturday and Sunday, use Excel’s NETWORKDAYS function. With the start date in A2 and end date in B2, enter =NETWORKDAYS(A2,B2). It counts working days in the date range and includes the start and end dates when they fall on working days. Therefore, its count is different from simply subtracting the dates, and a range that contains only a Saturday and Sunday returns 0.
To exclude holidays as well, put holiday dates in D2:D10 and use =NETWORKDAYS(A2,B2,$D$2:$D$10). The cell layout is still start date in A2, end date in B2, and holiday dates in D2:D10. For a Monday-to-Friday range from Monday, January 6, 2025, through Friday, January 10, 2025, the formula returns 5 if there are no listed holidays in that range. If January 8 is listed as a holiday, it returns 4.
NETWORKDAYS uses Saturday and Sunday as its weekend by default. When the weekend pattern differs, NETWORKDAYS.INTL lets you specify a weekend pattern. Check the function’s weekend argument carefully before using it; a different workweek should not be approximated by subtracting a fixed number of weekend days. The holiday range should contain actual Excel dates, and absolute references such as $D$2:$D$10 keep that range fixed when you copy the formula down.
Account for times as well as dates
Excel date-time values include a fractional part for the time of day. Subtracting two date-time values therefore returns a number of days that may include a decimal. For instance, a difference of one and a quarter days is 1.25 days, which represents 30 hours. If your cells contain times, the basic subtraction includes them automatically.
With a start date and time in A2 and an end date and time in B2, enter =B2-A2. If the start is January 10 at 9:00 a.m. and the end is January 11 at 3:00 p.m., the result is 1.25 days. Format the result as Number to see the decimal. To express that duration in hours, multiply the difference by 24; with the same cell layout, use =(B2-A2)*24, which returns 30 for this example.
Do not use an integer-only display if the fractional portion matters. A number format with zero decimal places may round the display and conceal partial days, even though the underlying result still contains them. For elapsed hours, also consider whether the timestamps cross daylight-saving changes or represent different time zones: Excel stores date-time values without time-zone information, so it cannot infer those adjustments on its own.
Fix common date-difference problems
- The result is a date: Change the result cell’s format to Number or General. The formula may be correct even when the display is confusing.
- The result is unexpectedly negative: Confirm which cell is the start date and which is the end date. Reverse the references if needed, or use an absolute difference only when direction does not matter.
- The formula returns an error or does not calculate: Check that the input cells contain valid dates rather than text. Imported dates can look correct while remaining text, particularly when their date order conflicts with Excel’s regional settings.
- A date is treated as text: Correct the source format or convert the value before subtracting. If A2 contains a text date Excel can interpret under the current locale,
=DATEVALUE(A2)converts it to an Excel date serial. DATEVALUE may not resolve ambiguous or locale-mismatched text correctly, so verify the converted result. - The difference is off by one: Decide whether you want elapsed days or an inclusive count. Adding 1 is appropriate only when both endpoint dates should be counted.
For a quick check, temporarily format the source cells as General. Valid dates should display as serial numbers, while text values remain text. You can also re-enter a questionable date or use Excel’s date conversion tools when importing data. Avoid applying a conversion formula blindly to mixed data: confirm that the resulting dates are correct before relying on the differences in a report.
Choose the calculation that matches the question
Different date questions call for different counting rules. Use ordinary subtraction for elapsed calendar days, add 1 for a range that includes both endpoint dates, and use NETWORKDAYS when weekends—and optionally holidays—should not count. Use date-time subtraction when the hour and minute matter, and multiply by 24 if the desired unit is hours.
DATEDIF is another function for measuring the interval between dates in units such as days, months, or years. It can be useful for age-style calculations, but it does not replace business-day counting, and month and year results are not simply fixed numbers of days. For a straightforward day difference, subtraction is easier to inspect and usually the clearest choice. Whichever method you use, write down the endpoint and weekend rules so the result is interpretable to someone reading the workbook later.
Frequently Asked Questions
How do I calculate days between two dates in Excel?
Put the earlier date in one cell and the later date in another, then subtract the earlier date from the later date. Format the result as a number if Excel displays it as a date.
How do I count both dates in an Excel date range?
Use an inclusive count by adding 1 to the date subtraction. This counts the start date and end date as part of the range; use it only when both endpoints are meant to be included.
How do I calculate working days between two dates?
Use NETWORKDAYS for a Monday-to-Friday workweek. It excludes Saturday and Sunday by default, includes working-day endpoints, and can also exclude a supplied list of holiday dates.
Why does Excel show a date instead of the number of days?
The result cell is probably formatted as a date. Change its number format to Number or General to display the day count.
Can Excel calculate the difference between dates and times?
Yes. Subtract the earlier date-time from the later one. The result is measured in days and may include a decimal; multiply it by 24 when you need elapsed hours.
Related
- Excel conditional formatting based on another cell?
- How to Calculate Age in Excel from Date of Birth
- Excel Not Clicking the Correct Cell? Causes and Fixes
Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.
More in How-to basics
- Excel New Sheet Shortcut: Add a Worksheet in SecondsIn Excel for Microsoft 365 on Windows, press Shift+F11 to insert a new worksheet. The new sheet is…
- Excel Max Cell Height: The 409-Point Row Height LimitIn Excel for Microsoft 365 on Windows, the maximum row height is 409 points, or about 5.68 inches…
- Excel conditional formatting based on another cell?Learn Excel conditional formatting from another cell with formula rules, reference examples, and fixes for common problems, so…
- VALUE Excel Cell Reference: Convert Text to NumbersIf A1 contains number-like text such as 42, enter =VALUE(A1) to convert it into the numeric value 42.…
- Excel: Calculate the Length of Time Between Two DatesTo find the elapsed number of days between two dates in Excel, subtract the earlier date from the…
- Excel Modify Drop-Down Lists: Steps, Tips and FixesTo modify an Excel drop-down list, select a cell that uses it, open Data > Data Validation, and…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.