To calculate the number of weeks between two dates in Excel, subtract the start date from the end date and divide the result by 7. For example, if your start date is in cell A2 and your end date is in cell B2, the formula is =(B2-A2)/7. This works because Excel stores dates as sequential serial numbers, meaning a difference of 1 equals one day.
What You'll Need
- A computer with Microsoft Excel installed (any version from 2010 onwards).
- A dataset containing at least two columns of dates.
- Dates formatted correctly as Date cells rather than Text cells.
Step-by-Step
- Prepare Your Data: Enter your start date in one cell (e.g., A2) and your end date in another cell (e.g., B2). Ensure that the end date is chronologically after the start date to avoid receiving a negative number.
- Select the Result Cell: Click on the cell where you want the number of weeks to appear (e.g., C2).
- Enter the Basic Formula: Type
=(B2-A2)/7into the formula bar. The parentheses are critical here; they tell Excel to perform the subtraction first to find the total number of days before dividing that total by the seven days in a week. - Press Enter: Once you hit Enter, Excel will display the result. If the result looks like a date (e.g., January 7, 1900) instead of a number, you must change the cell formatting.
- Adjust Cell Formatting: Go to the Home tab on the ribbon. In the Number group, click the dropdown menu (which likely says "Date") and select General or Number. This converts the date serial number back into a decimal value representing weeks.
- Handling Decimals (Optional): If the dates do not fall on the exact same day of the week, you will see a decimal (e.g., 4.28 weeks). To get a whole number, you can wrap your formula in a rounding function:
- For a rounded-down whole number of completed weeks:
=INT((B2-A2)/7) - For a mathematically rounded number:
=ROUND((B2-A2)/7, 0) - For a rounded-up number (counting any partial week as a full week):
=ROUNDUP((B2-A2)/7, 0)
- For a rounded-down whole number of completed weeks:
- Apply to Multiple Rows: If you have a long list of dates, hover your mouse over the bottom-right corner of cell C2 until a small black cross (the fill handle) appears. Click and drag the handle down to the bottom of your data range to copy the formula automatically.
Common Mistakes
One of the most frequent errors is forgetting the parentheses in the formula. If you type =B2-A2/7, Excel follows the order of operations (BODMAS/PEMDAS), which means it will divide the end date by 7 first and then subtract that result from the start date. This will result in a massive, nonsensical number because you are subtracting a small fraction of a date serial number from a large one.
Another common mistake is entering dates as text. If you type "Jan 1st 2023" instead of "1/1/2023", Excel may treat the entry as a string of text rather than a numerical value. When you try to subtract text, Excel will return a #VALUE! error. You can tell if a date is recognized as a number if it is automatically right-aligned in the cell; text is typically left-aligned by default.
Users also frequently forget to change the cell format. Because the formula involves dates, Excel often "guesses" that the output should also be a date. When the result of your calculation is 4, Excel sees that as the 4th day of its calendar (January 4, 1900), which is confusing for the user but logically consistent for the software.
Tips
If you need to calculate weeks based on a specific calendar week (e.g., the number of Monday-to-Sunday blocks) rather than a strict 7-day count, you can use the WEEKNUM function. While WEEKNUM tells you which week of the year a date falls in, you can subtract the WEEKNUM of the start date from the WEEKNUM of the end date. Note that this method can be tricky if the dates span across different years.
For projects spanning multiple years, use the DATEDIF function for more control. While DATEDIF doesn't have a specific "weeks" setting, you can use the "d" (days) setting and divide by 7: =DATEDIF(A2, B2, "d")/7. This is often more stable when dealing with complex date ranges or leap years.
To make your spreadsheet more professional, use Named Ranges. Instead of using B2 and A2, you can highlight your start date column and name it "StartDate" in the Name Box (top left). Your formula then becomes =(EndDate-StartDate)/7, which is much easier to read and audit months later.
Troubleshooting
If your formula is returning a #VALUE! error, the first step is to check your date formatting. Select your date cells and look at the Number format dropdown in the Home tab. If it says "Text", change it to "Short Date". If the dates don't change alignment, you may need to re-type them or use the "Text to Columns" feature under the Data tab to convert them to dates.
If the result is a negative number, it means your start date is later than your end date. If you want the absolute number of weeks regardless of which date comes first, wrap your formula in the ABS function: =ABS((B2-A2)/7). This converts any negative result into a positive one.
If you see a series of hashtags (#######) in the cell, it usually doesn't mean there is an error in the formula. Instead, it means the column is too narrow to display the result. Hover your mouse over the boundary between the column letters at the top and double-click to auto-fit the column width.
Frequently Asked Questions
How do I calculate only full weeks?
Use the INT function. By using =INT((B2-A2)/7), Excel will strip away the decimal remainder and only show you the number of complete 7-day periods that have passed.
Can I calculate weeks between dates excluding weekends?
Excel does not have a "weeks excluding weekends" formula because a week is defined as 7 days. However, you can use NETWORKDAYS(A2, B2) to find the number of working days and then divide that result by 5 to get the number of "work weeks."
Why does my result show as a date instead of a number?
Excel automatically applies the format of the source cells to the result cell. Since your source cells are dates, the result cell is formatted as a date. Change the format to "General" or "Number" via the Home tab.
Does this formula account for leap years?
Yes. Because Excel treats dates as a continuous count of days since January 1, 1900, it automatically accounts for the extra day in February during leap years when calculating the difference between two dates.
What is the difference between ROUND and INT for weeks?
INT always rounds down to the nearest whole integer, effectively ignoring partial weeks. ROUND will round up if the decimal is .5 or higher and down if it is lower, providing a more mathematically accurate approximation.