Excel Calculate Weeks and Days Between Dates
In this article
Excel can calculate the number of weeks and days between two dates using a combination of the DATEDIF function and simple arithmetic. You enter a start date and an end date, and the formula returns the full weeks and remaining days, for example "3 weeks, 2 days". This is useful for project timelines, age calculations, or tracking durations without manually counting.
in start | Start date | - | 2024-01-01 | 0 in end | End date | - | 2024-01-22 | 0 out weeks | Full weeks | weeks | DATEDIF(start, end, "d") / 7 | 0 out days | Remaining days | days | MOD(DATEDIF(start, end, "d"), 7) | 0
How Excel Stores Dates
To work with dates correctly, you need to know that Excel stores every date as a serial number. January 1, 1900 is serial number 1, January 2, 1900 is 2, and so on. This means you can subtract one date from another to get the number of days between them. For example, if cell A1 contains 2024-01-01 and B1 contains 2024-01-22, the formula =B1-A1 returns 21, because January 22 is 21 days after January 1.
This serial-number system is what makes date arithmetic possible. When you see a date like 2024-01-22, Excel is actually storing 45313. The display format is just a mask. Because of this, you can add or subtract days directly: =A1+7 gives you the date one week later. This is also why you should never enter dates as text—text dates cannot be subtracted and will cause errors.
The DATEDIF Function
DATEDIF is a hidden but powerful function in Excel. It calculates the difference between two dates in days, months, or years. The syntax is:
=DATEDIF(start_date, end_date, unit)
The unit argument can be:
"d"– total days"m"– complete months"y"– complete years"ym"– months remaining after full years"yd"– days remaining after full years"md"– days remaining after full months
For weeks and days, you first get the total days with "d", then divide by 7 to get weeks, and use the MOD function to get the remainder. The formula is:
=INT(DATEDIF(A1, B1, "d") / 7) & " weeks, " & MOD(DATEDIF(A1, B1, "d"), 7) & " days"
This returns a text string like "3 weeks, 0 days". If you want separate numeric values, use =INT(DATEDIF(A1,B1,"d")/7) for weeks and =MOD(DATEDIF(A1,B1,"d"),7) for days.
Worked Example with Default Values
Using the default values from the calculator above: start date 2024-01-01 and end date 2024-01-22.
- Calculate total days:
=DATEDIF("2024-01-01", "2024-01-22", "d")returns 21. - Divide by 7: 21 / 7 = 3, so there are 3 full weeks.
- Find remainder:
=MOD(21, 7)returns 0, so there are 0 remaining days. - Result: 3 weeks, 0 days.
The calculator block above shows the same: weeks = 3, days = 0. This matches because 21 days is exactly 3 weeks.
Using INT and MOD for Cleaner Results
Instead of DATEDIF, you can simply subtract the dates and use INT and MOD. The total days is =B1-A1. Then:
- Weeks:
=INT((B1-A1)/7) - Days:
=MOD(B1-A1,7)
This works because Excel dates are serial numbers. It is often simpler than DATEDIF and avoids any confusion with the function's hidden status. For example, if A1 is 2024-01-01 and B1 is 2024-01-10, then B1-A1 = 9. INT(9/7) = 1, MOD(9,7) = 2, so the result is 1 week and 2 days.
One advantage of this method is that it handles negative differences (if the end date is before the start date) more predictably. DATEDIF will return a #NUM! error in that case, while subtraction gives a negative number that you can handle with ABS if needed.
Formatting the Result as Text
To display the result as a readable sentence, combine the numbers with text using the ampersand (&). For example:
=INT((B1-A1)/7) & " weeks and " & MOD(B1-A1,7) & " days"
This gives "1 weeks and 2 days". To make it grammatically correct for singular weeks or days, you can use an IF statement:
=INT((B1-A1)/7) & " week" & IF(INT((B1-A1)/7)=1,"","s") & " and " & MOD(B1-A1,7) & " day" & IF(MOD(B1-A1,7)=1,"","s")
This will show "1 week and 2 days" instead of "1 weeks and 2 days". It is a small touch that makes reports look more professional.
Common Mistakes and How to Avoid Them
Several errors are common when calculating weeks and days in Excel:
- Entering dates as text: If you type "January 1, 2024" as a string, Excel won't recognize it as a date. Always use a valid date format (e.g., 2024-01-01) or the DATE function:
=DATE(2024,1,1). - Using DATEDIF with reversed dates: If start is after end, DATEDIF returns #NUM!. Check your arguments or use ABS on the difference.
- Rounding instead of truncating: Using ROUND instead of INT for weeks will give incorrect results. For example, 10 days divided by 7 is 1.43, ROUND gives 1, but 14 days divided by 7 is 2 exactly, ROUND gives 2, but 15 days gives 2.14, ROUND gives 2, which is correct, but 20 days gives 2.86, ROUND gives 3, which is wrong—there are only 2 full weeks. Always use INT to truncate.
- Ignoring the remainder: Some people just divide by 7 and get a decimal like 3.14, thinking it means 3 weeks and 1.4 days. The MOD function gives the actual remaining days.
Also note that DATEDIF with "d" counts the number of full days between the two dates. If you want to include the end date as a day (i.e., count both start and end), add 1 to the result. For example, from Jan 1 to Jan 2 is 1 day, but if you count both days it's 2. Decide which convention you need and be consistent.
Alternatives to DATEDIF
If DATEDIF is not available (it is hidden but works in all modern versions), you can use simple subtraction. Another alternative is the NETWORKDAYS function, which counts only weekdays, but that is for business days, not calendar weeks. For weeks and days, subtraction is the most transparent method.
For more complex calculations, such as weeks between two dates including the start day, you can adjust the formula: =INT((B1-A1+1)/7) and =MOD(B1-A1+1,7). This counts both endpoints. Always test with a known example to verify your logic.
Frequently Asked Questions
Why does DATEDIF show #NUM!?
DATEDIF returns #NUM! when the start date is later than the end date. Check the order of your arguments. If you need the absolute difference, use =ABS(DATEDIF(A1,B1,"d")) but note that DATEDIF still errors on reversed dates, so use =ABS(B1-A1) instead.
How do I calculate weeks and days excluding weekends?
For weekdays only, use NETWORKDAYS to get the number of working days, then divide by 5 for weeks and use MOD for remaining days. For example, =INT(NETWORKDAYS(A1,B1)/5) and =MOD(NETWORKDAYS(A1,B1),5). This gives work weeks and work days, not calendar weeks.
Can I calculate weeks and days between two dates including the start date?
Yes, add 1 to the total days before dividing. Use =INT((B1-A1+1)/7) for weeks and =MOD(B1-A1+1,7) for days. This counts both the start and end dates as full days.
What if the dates are in different years?
Excel handles that automatically because dates are serial numbers. For example, from 2023-12-25 to 2024-01-05 is 11 days, which is 1 week and 4 days. The formula works regardless of year boundaries.
How do I show the result as a number like 3.14 weeks?
Simply divide the total days by 7 and format the cell as a number with decimal places: =(B1-A1)/7. That gives 3.14 for 22 days, but note that 0.14 of a week is 1 day (0.14*7=0.98, actually 0.142857*7=1). To get a true decimal representation, use =ROUND((B1-A1)/7,2).
Does DATEDIF work in Excel for Mac and online?
Yes, DATEDIF works in Excel for Microsoft 365, Excel for Mac, and Excel for the web, though it is not listed in the function wizard. You can type it manually and it will calculate correctly.