Google Sheets Formula Days Between Dates Guide
In this article
To find the number of days between two dates in Google Sheets, the fastest method is simple subtraction: subtract the start date cell from the end date cell (e.g., =B1-A1). This works because Google Sheets stores dates as integers, where each whole number represents one full day. For more complex calculations, such as excluding weekends or calculating specific units like months or years, you can use the DAYS or DATEDIF functions.
What You'll Need
- A Google account with access to Google Sheets.
- A spreadsheet with at least two cells containing valid dates.
- Dates formatted correctly (e.g., MM/DD/YYYY or DD/MM/YYYY depending on your region).
Step-by-Step
- Enter Your Dates: Open your Google Sheet and input your start date in one cell (for example, cell A2) and your end date in another cell (for example, cell B2). Ensure that these cells are recognized as dates by Google Sheets; by default, dates are right-aligned in the cell.
- Select the Result Cell: Click on the empty cell where you want the total number of days to appear (for example, cell C2).
- Apply the Simple Subtraction Formula: Type
=B2-A2and press Enter. This tells Google Sheets to take the value of the later date and subtract the value of the earlier date. The result will be a positive integer representing the total calendar days between the two points. - Using the DAYS Function: If you prefer a formal function, type
=DAYS(B2, A2)and press Enter. The syntax for this function isDAYS(end_date, start_date). Note that the end date must come first in this specific formula to avoid receiving a negative number. - Using DATEDIF for Specific Intervals: If you need the difference in terms other than days, use the
DATEDIFfunction. Type=DATEDIF(A2, B2, "D"). The "D" tells the formula to return the difference in days. This function is particularly useful because you can change "D" to "M" for months or "Y" for years. - Drag to Fill: If you have a long list of dates, click the small blue square (fill handle) at the bottom-right corner of your result cell and drag it down the column. Google Sheets will automatically adjust the cell references (e.g., changing A2 and B2 to A3 and B3) for every row.
Common Mistakes
One of the most frequent errors is the Incorrect Date Format. If you type a date as "January 5th 2023," Google Sheets may treat it as text rather than a numerical date. When you try to subtract text, the formula will return a #VALUE! error. Always use standard date formats that your specific region recognizes, or use the Date Picker by double-clicking a cell formatted as a date.
Another common mistake is Reversing the Date Order. In simple subtraction (=B2-A2), if B2 is the earlier date, the result will be a negative number. While mathematically correct, this is usually not what the user intends for a duration calculation. In the DAYS function, the end date must always be the first argument; otherwise, you will see a negative result.
Users also frequently forget to Check Cell Formatting of the result cell. Sometimes, Google Sheets tries to be helpful and formats the result cell as a date because the formula references other date cells. If your result looks like "1/1/1900" instead of "1," you must change the formatting. Go to the Format menu > Number > Automatic or Number to see the actual integer of days.
Finally, there is the Inclusive Date Error. Standard subtraction calculates the difference between two dates, meaning it does not count the starting day. For example, from Monday to Tuesday is 1 day. If you are calculating a project duration where both the start and end day are working days, the result will be one day short. To fix this, you must add 1 to your formula: =(B2-A2)+1.
Tips
To calculate days between a date in a cell and today's date, use the TODAY() function. For example, =TODAY()-A2 will give you the number of days that have passed since the date in A2. This is ideal for tracking overdue invoices or countdowns to an event, as the number will update automatically every time you open the sheet.
If you need to calculate working days only (excluding Saturdays and Sundays), do not use simple subtraction. Instead, use the NETWORKDAYS function. The formula =NETWORKDAYS(A2, B2) automatically removes weekends from the count. You can even add a third argument to this formula to exclude a list of specific holiday dates: =NETWORKDAYS(A2, B2, E2:E10), where E2:E10 contains your holiday dates.
For those managing complex timelines, combining DATEDIF with text strings can create a human-readable age or duration. For example, =DATEDIF(A2, B2, "Y") & " Years, " & DATEDIF(A2, B2, "YM") & " Months" will output a result like "2 Years, 3 Months," which is much more useful for HR records or anniversary tracking than a raw number of days.
To ensure data integrity, use Data Validation on your date columns. Select your date cells, go to Data > Data validation, and add a rule that requires the input to be a valid date. This prevents users from entering text or typos that would break your subtraction formulas.
Troubleshooting
If your formula returns a #VALUE! error, the most likely cause is that one of your dates is being stored as text. To test this, use the formula =ISDATE(A2). If it returns FALSE, Google Sheets does not recognize the entry as a date. To fix this, select the column, go to Format > Number > Date. If it still doesn't change, you may need to re-type the date or use the Find and Replace tool to fix inconsistent separators (like using dots instead of slashes).
If the result is a strange date (like 12/30/1899) instead of a number, the cell is formatted as a Date. Click the cell, go to the Format menu, select Number, and then choose Number or Automatic. This will convert the date-formatted value back into the raw number of days.
If the result is a negative number, check the order of your cells. In a subtraction formula, the later date must be the first term. In the DAYS function, the end date is the first argument. Swap the cell references to correct the sign of the result.
If NETWORKDAYS is returning a number that seems too high or low, check your regional settings. In some regions, the weekend days differ. You can use NETWORKDAYS.INTL to specify which days are weekends. For example, =NETWORKDAYS.INTL(A2, B2, 11) treats only Sunday as a weekend.
Frequently Asked Questions
How do I calculate days between two dates including the start date?
Standard formulas calculate the difference, not the total count of days. To include the start date, simply add 1 to your result: =(B2-A2)+1.
Can I calculate the difference between dates in different years?
Yes. Google Sheets handles year transitions automatically. Whether the dates are in the same month or decades apart, simple subtraction or the DAYS function will provide the correct total count.
How do I find the number of days until a future date?
Use the formula =A2-TODAY(), where A2 is the future date. This will give you a countdown of days remaining until that date is reached.
What is the difference between DAYS and DATEDIF?
The DAYS function only returns the total number of days between two dates. DATEDIF is more versatile, allowing you to calculate the difference in days ("D"), months ("M"), or years ("Y").
Why is my date subtraction showing a decimal?
This happens if your cells contain timestamps (date and time) rather than just dates. Since time is represented as a fraction of a day, the result will be a decimal. Use the INT function to round down to the nearest whole day: =INT(B2-A2).