To find the elapsed number of days between two dates in Excel, subtract the earlier date from the later one: with the start date in A2 and end date in B2, enter =B2-A2. Format the result as a number, not a date. For complete months or years, or for working days only, use a formula suited to that specific meaning of “length of time.”
Quick answer: subtract the dates
Excel stores valid dates as serial numbers, so ordinary subtraction returns the number of days between them. With A2 containing January 10, 2025, and B2 containing March 5, 2025, the formula =B2-A2 returns 54. That is the elapsed time: the end date is 54 days after the start date.
To try it in Microsoft Excel for Microsoft 365 on Windows:
- Enter the start date in A2 and the end date in B2. Make sure Excel recognizes both entries as dates.
- Enter
=B2-A2in C2 and press Enter. - If C2 appears as a date, select it and choose Home > Number Format > General or Number.
Excel may apply a date format to a result because the cell was previously formatted that way. The subtraction can still be correct; changing the result cell’s format reveals the day count.
What “between two dates” can mean
A date difference is not always a single, unambiguous measurement. Subtracting dates gives elapsed days, while a person asking for the time between dates might want full calendar months, years of age, weekdays, or a count that includes both the first and last dates. Decide what you need before choosing a formula.
- Elapsed days: The number of 24-hour date intervals between the two dates. January 10 to January 11 is one day.
- Inclusive calendar-day count: The number of dates touched, counting both endpoints. January 10 through January 11 covers two calendar dates.
- Completed months or years: Whole calendar units that have passed, rather than an approximate conversion from days.
- Working days: Weekdays between dates, optionally excluding specified holidays.
These answers differ by design. For a report or policy, state whether the start date, end date, weekends, and holidays count. That prevents a technically correct formula from answering the wrong question.
Calculate complete months or years with DATEDIF
Excel’s DATEDIF function calculates the number of complete units between two dates. It is useful for ages, service periods, and contract durations, where “three years” generally means three full anniversaries have passed, not 1,095 days divided by 365.
With the start date in A2 (January 10, 2022) and the end date in B2 (March 5, 2025), enter =DATEDIF(A2,B2,"y") to return 3 complete years. The next anniversary after January 10, 2025 has not yet occurred, so the completed-year count is three.
With the same dates in A2 and B2, enter =DATEDIF(A2,B2,"m") to return 37 complete months. January 10, 2025 to February 10, 2025 completes the 37th month; March 5 is before the next full-month anniversary on March 10. The unit “m” means total complete months, not the month portion after whole years.
DATEDIF also accepts “ym” for remaining complete months after whole years and “yd” for remaining days after whole years. Be careful with “md”: Microsoft notes that it can produce an inaccurate result in some situations, so it is usually better to avoid it for important calculations. DATEDIF also requires the start date to be earlier than or equal to the end date; reversed dates can return an error.
Show a duration in days, months, or years
The formula and the cell’s number format work together. A subtraction result is a number of days, but a date-style format may display that number as a calendar date. Select the result cell and use Home > Number Format to choose General or Number for a day count. Increase or decrease decimal places if you are working with date-times and need to show a fraction of a day.
For an elapsed period expressed in complete years, months, and remaining days, you can combine DATEDIF units. With A2 holding January 10, 2022, and B2 holding March 5, 2025, enter =DATEDIF(A2,B2,"y")&" years, "&DATEDIF(A2,B2,"ym")&" months, "&DATEDIF(A2,B2,"md")&" days" only if the remaining-day calculation is appropriate for your dates. Because the “md” unit can be unreliable in some cases, a safer reporting approach is to show completed years and months separately, or calculate the remaining days by subtracting a properly constructed anniversary date.
A simpler choice for a duration displayed as years and months is to use the complete-year and remaining-month units without the day remainder. With the same dates in A2 and B2, =DATEDIF(A2,B2,"y")&" years, "&DATEDIF(A2,B2,"ym")&" months" returns “3 years, 1 months.” If you want polished text, account for singular and plural wording; the underlying numeric result is still three years and one month.
Count weekdays and exclude holidays
For work schedules, deadlines, or turnaround calculations, NETWORKDAYS counts weekdays in a date range and can omit holidays. It counts both endpoints when they fall on weekdays. That inclusive behavior matters: Monday through Friday returns five working days, even though subtracting the dates returns four elapsed days.
With a Monday start date in A2, a Friday end date in B2, and holiday dates listed in H2:H10 (leave unused cells in that range blank), enter =NETWORKDAYS(A2+1,B2,H2:H10) to count weekdays after the start date through the end date. For April 7–11, 2025, with no holidays in the range, the result is 4: Tuesday, Wednesday, Thursday, and Friday. The A2+1 adjustment excludes the start date; omit it if your rule counts both endpoints.
NETWORKDAYS uses Saturday and Sunday as the weekend. If your workplace has different weekend days, use NETWORKDAYS.INTL, which lets you specify weekend patterns. For a normal Monday-to-Friday calendar, NETWORKDAYS is simpler and less prone to configuration mistakes. Enter actual Excel dates in the holiday range, not text that merely looks like a date.
Include hours and minutes in the calculation
Excel dates can include a time fraction. For example, 12 noon is half of a day in the stored value. If A2 contains a start date and time and B2 contains an end date and time, subtracting them returns elapsed days including the fractional part. A result of 1.5 represents 36 hours.
To display the result as total elapsed hours and minutes rather than a clock time, apply a custom number format such as [h]:mm. The square brackets allow hours to accumulate beyond 24; without them, a duration of 28 hours may display as 4:00 because ordinary time formats wrap around at midnight. For the same reason, do not format a multi-day duration as a standard time of day.
Check that both cells contain the intended date and time. If one entry has no time, Excel treats it as midnight. A start value of 9:00 AM and an end value of 1:00 PM on the next day produces 28 elapsed hours, not four. If the result is negative, the end date-time is earlier than the start date-time; reverse the inputs or decide how your calculation should handle that case.
Choose the method that matches the question
Use this quick guide to avoid mixing calendar units with elapsed time:
- Use subtraction for exact elapsed days, or for date-times when you want a fraction of a day.
- Use DATEDIF with “y” for completed years and “m” for total completed months.
- Use NETWORKDAYS when Saturdays and Sundays should not count as workdays; include a holiday range if needed.
- Use a custom duration format such as [h]:mm when a date-time difference should display as total hours and minutes.
- Add 1 to an elapsed-day result only when your counting rule includes both the start and end dates.
There is no reliable universal conversion of a month to a fixed number of days: months have different lengths. Similarly, a year can contain 365 or 366 days. If a task asks for “one month,” use calendar-month logic rather than dividing a day count by 30. For financial or legal rules, follow the stated convention, which may define its own day-count method.
Common problems and how to fix them
The result looks like a date. Change the result cell to General or Number. The underlying subtraction may already be right; the display format is the issue.
The formula returns an error or an unexpected number. Check that both inputs are valid Excel dates, not text strings. A value aligned or imported as text may look like a date without behaving like one. Re-enter it using a recognized date format, or convert the source data before calculating. Date interpretation can also depend on regional settings: 03/04/2025 may mean March 4 or April 3.
The answer is one day off. Subtraction measures elapsed days and excludes the starting date as a separate counted day. If a form asks for calendar dates covered inclusively, add one to the day difference. For example, with January 10 in A2 and January 11 in B2, =B2-A2 returns 1 elapsed day, while the inclusive count is 2 dates.
The result is negative. B2 is earlier than A2. That may be intentional, but DATEDIF requires the earlier date first. If records can arrive in either order, first establish which cell is the start and which is the end rather than silently hiding a negative result.
A date appears one day different after opening a file. Excel workbooks can use different date systems, and imported values may also be affected by regional date interpretation. If a workbook is shared or contains imported dates, verify several known dates and the workbook’s date-system setting before relying on the results.
Frequently Asked Questions
What is the simplest formula to get days between two dates in Excel?
Subtract the start date from the end date. If the start is in A2 and the end is in B2, use =B2-A2. Format the result as General or Number to see the elapsed-day count.
How do I calculate the number of months between two dates?
For complete months, use DATEDIF with the “m” unit. With the earlier date in A2 and later date in B2, =DATEDIF(A2,B2,"m") returns the total number of full months, not a rounded estimate based on days.
Should I add one to include both dates?
Add one only when you want to count both endpoints as calendar dates. Ordinary subtraction measures elapsed intervals, so January 10 to January 11 is one elapsed day but covers two dates inclusively.
How can I calculate business days between dates?
Use NETWORKDAYS for weekdays, optionally supplying a range of holiday dates. It counts weekday start and end dates inclusively, so adjust the start date or result if your rule excludes the first day.
Why does Excel show a date instead of the number of days?
The result cell is probably formatted as a date. Select it and change its number format to General or Number. The formula can be correct even when the displayed format is unsuitable.
Related
- Excel Not Responding: Should You Wait or Close It?
- How to Split First and Last Name in Excel
- How to Freeze Top Row and First Column in Excel
Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.
More in How-to basics
- Find Excel Spreadsheet Not Saved? Recovery Steps That WorkIf you closed an Excel workbook without saving, open Excel and select File > Info > Manage Workbook…
- 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…
- Excel New Note Shortcut: Add and Edit Notes QuicklyIn Excel for Microsoft 365 on Windows, select a cell and press Shift+F2 to create a new note;…
- Excel Day Month Year Format: Dates That Display ClearlyTo display Excel dates as day, month, year, select the date cells, press Ctrl+1, choose Custom, and enter…
- Excel Weekday Name: Show the Day from Any Date in ExcelTo show the weekday name for a date in Excel, put the date in A2 and enter =TEXT(A2,"dddd")…
- Text in Excel: Translate It Into EnglishYes—Excel for Microsoft 365 can translate text into English with the TRANSLATE function or the Translate command on…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.