To find how many days separate two dates in Excel, subtract the start date from the end date: with the start date in A2 and the end date in B2, enter =B2-A2. For example, June 1 to June 10, 2025 returns 9 days; add 1 if you want to count both calendar dates inclusively.
The basic date-difference formula
Excel stores valid dates as serial numbers, so ordinary subtraction works: each successive date has a serial number one greater than the previous date. The formula =B2-A2 calculates the number of days from the date in A2 to the date in B2. It does not count the starting date as a full day; it measures the gap between the dates.
For example, with June 1, 2025 in A2 and June 10, 2025 in B2, the result is 9. If the cell shows another date instead of 9, the calculation may be correct but the result cell is formatted as a date. Select the result cell, open Home > Number Format, and choose General or Number. A result formatted as General or Number displays the day count directly.
For a quick calculation without cell references, you can subtract date values typed into a formula, but referencing cells is usually easier to maintain. It also lets you change either date without rewriting the formula. Keep the start date and end date in separate cells, and use clear column headings so it is obvious which date comes first.
Choose between subtraction and DATEDIF
Subtraction is the simplest and most transparent method for an ordinary day count. Excel also supports DATEDIF, a function that returns the difference between two dates in a specified unit. With the start date in A2 and the later end date in B2, enter =DATEDIF(A2,B2,"d"); June 1 to June 10, 2025 returns 9. The "d" argument requests days.
DATEDIF can be useful when a workbook already uses it to calculate age or date intervals in different units. For just the number of elapsed days, it offers little advantage over subtracting the cells. It also expects the start date to be earlier than or equal to the end date. If the dates are reversed, DATEDIF can return a #NUM! error, whereas subtraction gives a negative number that makes the direction visible.
Choose based on what the result should mean:
- Use subtraction for a straightforward, signed difference between two dates.
- Use DATEDIF with the "d" unit when that function’s interval-based structure is helpful in a larger date calculation.
- Use a business-day function when weekends or holidays should not count.
Count both the start and end dates
A frequent source of disagreement is whether a day count should include one or both endpoints. Subtracting June 1 from June 10 returns 9 because there are nine date changes between those dates. If a project schedule, travel plan, or leave request should count June 1 and June 10 as included days, add one to the difference.
With the start date in A2 and the end date in B2, use =B2-A2+1. For June 1 through June 10, 2025, the result is 10 calendar dates. This is an inclusive count, not a different way to calculate elapsed time. Confirm the counting rule before comparing results with a policy, invoice, contract, or application; some rules include the start date, while others count only completed days after it.
If the dates can appear in either order and the goal is always a nonnegative gap, use the absolute value of the difference. With dates in A2 and B2, =ABS(B2-A2) returns 9 for June 1 and June 10, regardless of which cell contains the earlier date. For an inclusive count that also ignores order, use =ABS(B2-A2)+1. Do not use these versions if a negative result is useful for identifying dates entered in the wrong order.
Calculate working days and exclude holidays
Calendar days include Saturdays, Sundays, and holidays. To count Monday-to-Friday workdays instead, Excel provides NETWORKDAYS. With a Monday start date of June 2, 2025 in A2 and a Friday end date of June 6, 2025 in B2, enter =NETWORKDAYS(A2,B2). The result is 5 because the function counts both endpoints when they are workdays.
NETWORKDAYS can exclude listed holidays too. If the holiday dates are in H2:H10, and A2 and B2 contain the June 2 and June 6 dates, enter =NETWORKDAYS(A2,B2,H2:H10). If H2 contains June 4, 2025 and the other holiday cells are blank or contain other dates, the result for this five-day Monday-to-Friday interval is 4. Put actual Excel dates in the holiday range, not text that merely looks like dates.
For a work schedule with a different weekend pattern, use NETWORKDAYS.INTL. Its weekend argument can specify a built-in weekend code or a seven-character pattern, ordered Monday through Sunday, where 1 marks a nonworking day and 0 marks a working day. For example, with A2 and B2 holding the June 2–6, 2025 dates and H2:H10 holding holidays including June 4, enter =NETWORKDAYS.INTL(A2,B2,1,H2:H10). Weekend code 1 means Saturday and Sunday; the result is 4. This function is useful for schedules that do not follow a standard Monday-to-Friday week.
Understand dates that include times
Excel can store a time as a fraction of a day alongside a date. Consequently, subtracting two cells that contain both dates and times returns a number that may include a decimal. For example, if A2 is June 1, 2025 at 9:00 AM and B2 is June 2, 2025 at 8:00 AM, =B2-A2 returns 23 hours expressed as a fraction of a day: approximately 0.958333.
If you want the duration in hours, multiply that difference by 24. With those same date-and-time values in A2 and B2, =(B2-A2)*24 returns 23. Format the result as Number if Excel displays it as a date or time. If you instead want the number of calendar-date boundaries crossed, regardless of the times, compare the date portions: with timestamps in A2 and B2, =INT(B2)-INT(A2) returns 1 for this example. That is not the same as a full 24-hour duration, so choose the calculation that fits the question.
When showing a duration as hours and minutes, a custom format such as [h]:mm can display totals beyond 24 hours without starting over at zero. This differs from a time-of-day display, which normally wraps after 24 hours. The underlying subtraction still determines the duration; cell formatting controls how Excel presents it.
Check date entry, formatting, and reversed dates
A formula can fail or return an unexpected result when one or both inputs are not recognized as dates. A value that looks like 6/1/2025 may be stored as text because it was imported from another system or interpreted under a different regional date convention. Subtracting text can produce a #VALUE! error. Check whether the cells behave as dates when you change their number format and whether sorting them places them in chronological order.
If imported dates are text, use Data > Text to Columns to convert them when the source format is consistent: select the affected column, choose the date order that matches the source, and complete the conversion. Be careful with ambiguous entries such as 03/04/2025, which could mean March 4 or April 3 depending on the source convention. Converting with the wrong order can create valid dates that are still incorrect.
Also check which date is in which cell. A2 as the start date and B2 as the end date produces a negative result if B2 is earlier. That is mathematically expected. Correct the input order if the dates were swapped, or use ABS only when the direction genuinely does not matter. If a negative result appears as a row of number signs or cannot be displayed as a date, format the result as General or Number to inspect its value.
Excel’s normal Windows date system uses serial dates, but workbooks can use a different date system, particularly when workbooks created with older Mac settings are involved. When dates from different workbooks are copied or linked, a 1,462-day offset can indicate a 1900-versus-1904 date-system mismatch. Verify the source dates and workbook settings before treating a large difference as a formula error. For typical modern workbooks created and edited with the same settings, simple date subtraction is the appropriate calculation.
Format and copy the result correctly
For a one-off calculation, type the formula in the result cell and press Enter. To apply it down a table, select the first result cell and use its fill handle to copy the formula to adjacent rows. Excel adjusts relative references automatically: a formula using A2 and B2 becomes one using A3 and B3 on the next row. Check the first few copied results, especially if the table contains blank cells, unusual dates, or different counting rules.
In Excel for Microsoft 365 on Windows, Ctrl+1 opens Format Cells; on a Mac, Command+1 opens the corresponding formatting dialog. Choose Number or General for a numeric day count. If you see a date instead, changing the result format does not change the calculation—it only changes how the serial value is displayed. In Excel for the web, use the Number Format controls on the Home tab; the available interface is browser-based, but the subtraction formula works the same way.
Frequently Asked Questions
What is the simplest Excel formula for days between two dates?
With the start date in A2 and end date in B2, use =B2-A2. It returns the elapsed day difference, so June 1 to June 10 returns 9.
How do I count every date, including both endpoints?
With the start date in A2 and end date in B2, use =B2-A2+1. This counts both dates, so June 1 through June 10 returns 10.
Why does Excel show a date instead of a number of days?
The result cell is probably formatted as a date. Change its number format to General or Number; the formula can remain unchanged.
How do I count weekdays between two dates?
With the first date in A2 and the last date in B2, use =NETWORKDAYS(A2,B2). Add a holiday range as a third argument if those dates should also be excluded.
Can Excel calculate days between dates in different cells?
Yes. Put the start and end dates in separate cells, such as A2 and B2, then subtract the start cell from the end cell with =B2-A2. Ensure both inputs are recognized Excel dates rather than text.
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 Formula Explainer: paste any formula and see each function and reference in plain English.
More in Formulas & functions
- Excel MID and FIND Functions: How to Extract Text in ExcelWith the text INV-2026-047 in A2, use =MID(A2,FIND("-",A2)+1,4) to extract the year; the result is 2026. MID returns…
- SUMIF Excel Shortcut: The Fastest Way to Use ItExcel has no dedicated keyboard shortcut that inserts a SUMIF formula automatically. The quickest method is to type…
- COUNTIF Excel: How to Reference Cells in CriteriaTo make COUNTIF use a cell as its criterion, put the cell reference in the second argument: with…
- Filter Excel for Empty Cells: Blanks and FormulasTo filter for empty cells in Excel for Microsoft 365 on Windows, select a cell in your data,…
- Concat Excel Cell Range: Join Cells With Simple FormulasWith the values to join in A2:A5, enter =CONCAT(A2:A5) to combine the range into one text string; for…
- Excel Sum Same Cell Across Tabs: The 3-D Formula GuideIf the sheets you want to total are next to one another in the workbook, use a 3-D…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.