To get the number of days between two dates in Excel or Google Sheets, subtract them: if the start date is in A2 and the end date in B2, use =B2-A2. With 15 January 2026 and 10 March 2026, the answer is 54. Both programs store dates as numbers counted in days, so ordinary arithmetic works. Everything below works the same in both, unless noted.
Enter dates safely
A date typed as 03/04/2026 means 3 April in Pakistan, India and the UK, but 4 March in the US. Spreadsheets read it using your locale settings, which can silently swap day and month. To avoid that, build dates with =DATE(2026,3,10) (year, month, day), or type them as 2026-03-10. If a result looks like a date instead of a number, change the cell format to Number.
Days between dates
=B2-A2gives the exclusive count: 54 for our example.=B2-A2+1includes both the start and end days: 55.=DAYS(B2,A2)does the same as subtraction. Note the end date comes first.=TODAY()-A2gives days since a date, and=A2-TODAY()days until it. TODAY() updates every time the sheet recalculates.
DATEDIF for years, months and days
=DATEDIF(start, end, unit) counts complete units. It works in both programs, though Excel does not list it in its function suggestions. The start date must be earlier than the end date or you get an error.
| Unit | Returns |
|---|---|
"y" | Complete years |
"m" | Complete months |
"d" | Days (same as subtraction) |
"ym" | Months left over after whole years |
"yd" | Days left over after whole years |
"md" | Days left over after whole months |
For age, combine them: =DATEDIF(A2,TODAY(),"y")&" years, "&DATEDIF(A2,TODAY(),"ym")&" months". For someone born on 23 May 1990, today that returns 36 years, 4 months. Be careful with "md": Microsoft itself warns it can give wrong results near month ends, so for exact ages in years, months and days use our age calculator instead.
Working days: NETWORKDAYS and WORKDAY
=NETWORKDAYS(A2,B2) counts Monday to Friday days between two dates, including both ends. For 15 January to 10 March 2026 it returns 39. Add a range of holiday dates as a third argument: =NETWORKDAYS(A2,B2,H2:H20).
=WORKDAY(A2,10) returns the date 10 working days after A2, skipping weekends. From 15 January 2026 it gives Thursday, January 29, 2026. Use a negative number to count back.
Other weekends with NETWORKDAYS.INTL
=NETWORKDAYS.INTL(A2,B2,weekend,holidays) and WORKDAY.INTL let you choose the weekend. Useful codes:
- 1 Saturday–Sunday (the default), 7 Friday–Saturday, 11 Sunday only, 16 Friday only, 17 Saturday only.
- Or a seven-character string starting on Monday, where 1 means a day off:
"0000011"is Saturday–Sunday and"0000110"is Friday–Saturday.
For a six-day week with only Sunday off, common in Pakistani and Indian businesses, use code 11. More on this in how to count business days.
Adding months: EDATE and EOMONTH
=EDATE(A2,6) gives the same day six months later, adjusting for short months: 31 August plus 6 months gives 28 February (or 29th in a leap year). =EOMONTH(A2,0) returns the last day of A2’s month, which is useful for billing and due dates. Adding days is simpler: =A2+90 is 90 days later.
Week numbers: WEEKNUM vs ISOWEEKNUM
=WEEKNUM(A2) uses the US system by default: weeks start on Sunday and week 1 is the week containing 1 January. =ISOWEEKNUM(A2) uses ISO 8601: weeks start on Monday and week 1 contains the year’s first Thursday. The two can differ by one, especially in early January and late December. =WEEKNUM(A2,21) also returns the ISO week. Today, October 6, is ISO week 41; check any date on our week number page, and read week numbers explained for the rules.
Weekday names
=TEXT(A2,"dddd") shows the day name, such as Monday. =WEEKDAY(A2,2) returns 1 for Monday through 7 for Sunday, handy for filtering weekends.
If you only need a quick answer, our date duration calculator gives days, weeks, months and weekdays between any two dates with no formulas.
Frequently asked questions
Why does my date subtraction show a date instead of a number?
The result cell has a date format. Change it to Number or General and you will see the count of days.
Does NETWORKDAYS include the start date?
Yes. NETWORKDAYS counts both the start and end dates if they are working days, unlike plain subtraction.
Is DATEDIF available in Google Sheets?
Yes. Google Sheets supports DATEDIF with the same units as Excel, including y, m, d, ym, yd and md.
What is the difference between WEEKNUM and ISOWEEKNUM?
WEEKNUM defaults to Sunday-start weeks with week 1 containing 1 January. ISOWEEKNUM uses Monday-start weeks with week 1 containing the first Thursday, as used in Europe and much of the world.