To calculate the number of days between two dates in Excel, simply subtract one date from another. Excel stores dates as serial numbers, so subtracting them returns the exact number of days between them. No add-ins or special functions are required—this works in all modern versions of Excel on Windows, Mac, or online.
What You'll Need
- A working version of Microsoft Excel (2010 or later)
- Two valid date values entered in separate cells
- At least one empty cell to display the result
Step-by-Step
- Open your Excel workbook and identify the two cells containing the start and end dates. For example, enter the start date in cell A2 (e.g., 1/15/2024) and the end date in cell B2 (e.g., 3/22/2024).
- Click on the cell where you want the result to appear, such as C2.
- Type the formula:
=B2-A2. Do not include quotation marks or spaces around the cell references. - Press Enter. The cell will now display the number of days between the two dates—in this case, 66.
- If the result appears as a date instead of a number, right-click the cell, select Format Cells, choose Number from the Category list, then click OK. This ensures Excel displays the result as a whole number rather than a date format.
- To calculate days between dates in reverse (e.g., from a future date to a past date), still use the same formula. Excel will return a negative number if the end date is earlier than the start date, which is useful for tracking overdue items or time elapsed.
- For a more explicit formula, you can wrap the subtraction in the ABS function to always return a positive number:
=ABS(B2-A2). This is helpful when you only care about the magnitude of days, not direction. - To extend this to multiple rows, click the bottom-right corner of the result cell (C2) and drag down to copy the formula to other rows. Excel will automatically adjust the cell references (e.g., A3, B3, C3, etc.) if your data is in a table format.
Common Mistakes
- Entering dates as text instead of actual date values. For example, typing January 15, 2024 as plain text won’t work. Use formats Excel recognizes: MM/DD/YYYY, DD-MM-YYYY, or YYYY-MM-DD. If Excel doesn’t recognize it as a date, the formula will return an error.
- Using the wrong cell order. If you subtract the earlier date from the later date (e.g., A2-B2 instead of B2-A2), you’ll get a negative result. This isn’t an error, but if you expect a positive number, double-check your order.
- Formatting the result cell as a date. If the cell showing the day count is formatted as a date, you’ll see a serial date (like 1/1/1900) instead of the number 66. Always format the result cell as Number or General.
- Including time values without accounting for them. If your dates include timestamps (e.g., 1/15/2024 14:30), Excel still counts the full day difference, but the decimal portion represents time. To get whole days only, wrap the formula in INT:
=INT(B2-A2). - Referencing blank cells. If either date cell is empty, Excel treats it as 0, which equals December 31, 1899. This causes wildly incorrect results. Always validate that both cells contain valid dates before calculating.
Tips
- Use the TODAY() function to calculate days from today:
=TODAY()-A2. This dynamically updates every day, useful for tracking deadlines or aging invoices. - Combine with IF statements for conditional logic:
=IF(B2="","Pending",B2-A2)prevents errors if the end date isn’t entered yet. - For calendar days excluding weekends, use NETWORKDAYS:
=NETWORKDAYS(A2,B2). For holidays too, add a range of holiday dates as a third argument. - Use DATE(YYYY,MM,DD) to hardcode dates in formulas:
=DATE(2024,3,22)-DATE(2024,1,15). This avoids cell reference errors when the source data moves. - Highlight date cells with conditional formatting to quickly spot invalid entries. Select the range, go to Home > Conditional Formatting > New Rule > Use a formula:
=NOT(ISNUMBER(A2)), then set a red fill. - Copy and paste values only after calculating to avoid formula drift. Right-click > Paste Special > Values if you’re sharing the file and others shouldn’t see the underlying formula.
Troubleshooting
- Formula returns #VALUE! This means one or both cells contain non-date text. Check each date cell with the ISNUMBER function:
=ISNUMBER(A2). If it returns FALSE, the cell is not a valid date. Re-enter the date using a recognized format, or use Data > Text to Columns to convert text to dates. - Formula returns a very large or negative number This happens if Excel interprets your entry as a date from the 1900s or 1904 system. Go to File > Options > Advanced > Use 1904 date system and uncheck it if enabled. Also ensure your system date format matches your entry style.
- Result shows #### This means the column is too narrow to display the number. Widen the column by dragging the header boundary or double-clicking it.
- Formula works in one cell but not another Check for leading/trailing spaces. Use TRIM:
=TRIM(A2)in a helper column, then re-reference that. - Working on a Mac and dates look different Excel for Mac uses the same serial system as Windows, but regional settings may affect input. Use the date picker (click the cell, then the calendar icon) to ensure accuracy.
- Sharing with someone who sees #NAME? This occurs if they’re using an older Excel version without proper date support. Re-enter the formula or save the file in .xls format for compatibility, though this limits features.
Frequently Asked Questions
Can I calculate days between dates without using cell references?
Yes. Use the DATE function:=DATE(2024,12,25)-DATE(2024,1,1). This gives you 359 days without needing external cells.
What if I want to exclude weekends from the count?
Use the NETWORKDAYS function:=NETWORKDAYS(start_date,end_date). It automatically excludes Saturdays and Sundays. For custom weekends, use NETWORKDAYS.INTL with a code like =NETWORKDAYS.INTL(A2,B2,7) to exclude only Sundays.
Can I calculate days between today and a future date?
Yes. Use=B2-TODAY(). If B2 is your future date, this shows how many days remain. If the result is negative, the date has passed.