Date Differences in Excel and Google Sheets
The formulas for date differences, workdays and adding months, and the pitfalls to avoid.
By the Universal Date Calculator Team
How spreadsheets store dates
A spreadsheet stores a date as a number: the count of days since a starting date. In Excel on Windows the count starts at 1 January 1900, so 22 October 2026 is stored as 46317. Google Sheets counts from 30 December 1899, which gives the same serial number for dates after 1900. The date format you see is only a way of displaying the number.
This is why date arithmetic in a spreadsheet is so easy: subtracting one date from another gives the number of days between them, and adding a number to a date gives a later date. If a result looks like a date when you expected a number, change the cell format to General or Number.
Days between two dates
The simplest formula is a subtraction: =B1-A1, where A1 holds the start date and B1 the end date. It gives the elapsed days, which is an exclusive count. The same result comes from =DAYS(B1,A1), where the end date comes first.
To count both ends, add one: =B1-A1+1. For example, from 19 to 23 October 2026 the subtraction gives 4 and the inclusive formula gives 5. Decide which count you need before you build the sheet.
If a cell contains text that looks like a date, such as 2026-10-22 pasted from another program, the formula may return an error. Check that the cell is a real date, and convert it with DATEVALUE if it is not.
Years, months and days with DATEDIF
DATEDIF returns the difference in complete years, months or days, according to a unit code: "Y" for complete years, "M" for complete months, "D" for days, "YM" for months ignoring years, and "YD" for days ignoring years. A formula such as =DATEDIF(A1,B1,"Y") gives an age in years.
Both Excel and Google Sheets support DATEDIF, although Excel hides it from the function list. Combine units to build an age in words: years with "Y", months with "YM", and so on.
There is one unit to avoid. The "MD" unit, days ignoring months and years, is documented by Microsoft as unreliable: it may return a negative number, zero or an inaccurate result. For the days part of an age, subtract the first day of the end date’s month from the end date instead, or use a calculator.
Workdays: NETWORKDAYS and WORKDAY
NETWORKDAYS(start, end, holidays) counts the Monday-to-Friday days between two dates, including both the start and the end date if they are workdays. The optional holidays argument is a range of dates to exclude. For 19 to 23 October 2026 it returns 5.
WORKDAY(start, days, holidays) goes the other way: it returns the date that is a given number of workdays from the start, skipping weekends and the listed holidays. Ten workdays after 2 November 2026 is 16 November 2026.
If your weekend is not Saturday and Sunday, use NETWORKDAYS.INTL and WORKDAY.INTL. They take a weekend code, or a seven-character string starting on Monday where 1 marks a day off, such as "0000011" for the usual weekend.
Adding months, month ends and week numbers
EDATE(start, months) adds a number of whole months to a date and keeps the day number, using the last day of the month where the target month is shorter. EDATE of 31 January 2026 with 1 returns 28 February 2026. EOMONTH(start, months) returns the last day of the month that many months away.
WEEKDAY(date) returns the day of the week as a number, and the optional second argument sets which day counts as 1. ISOWEEKNUM(date) returns the ISO week number, while WEEKNUM(date) with its default setting uses a different, US-style system. For 22 October 2026, ISOWEEKNUM returns 43.
The functions behave the same way in Excel and in Google Sheets for ordinary dates, which makes it easy to move a sheet from one to the other.
Pitfalls to watch for
- Text instead of dates: a pasted date that is left-aligned is probably text.
- Regional formats: 04/05/2026 can be 4 May or 5 April depending on the system settings.
- The 1900 leap-year quirk: Excel treats 1900 as a leap year for compatibility, so serial numbers before 1 March 1900 are off by one.
- Two date systems: Excel for Mac once used a system starting in 1904, which can shift imported dates by about four years.
- Inclusive or exclusive: write the rule next to the formula.
A note beside the formula that says days between, end date not counted can save an argument six months later.
Checking a sheet with the calculator
A date calculator is a good independent check. Enter the same two dates, compare the days, weeks and workdays with your sheet, and look for a difference. Because the calculator states its rules, it also helps you decide which formula matches the rule you need.
For a one-off question, you may not need a spreadsheet at all. The days-between and add-or-subtract tabs answer most of what the formulas above do, and they show the weekday, the ISO week and the breakdown in years, months and days as well.
Check your dates
Open the date calculator