Four functions cover most date work in Excel. TODAY returns the current date, DATEDIF measures the gap between two dates in years, months or days, EDATE moves a date forward or back by whole months, and NETWORKDAYS counts working days between two dates. Which one you need depends on two questions: what unit do you want back, and should the answer change when the workbook is opened tomorrow?
It sits within the Essential Spreadsheet Formulas and Functions pillar, and the same date logic applies to Google Sheets and LibreOffice Calc with minor differences noted below.
The four functions at a glance
| Function | Purpose | Syntax | Returns | Typical use |
|---|---|---|---|---|
| TODAY | Current date | =TODAY() | A date serial, changes daily | Days remaining, ageing reports |
| DATEDIF | Elapsed time between two dates | =DATEDIF(start, end, unit) | A whole number in the unit requested | Age, tenure, service length |
| EDATE | Date shifted by whole months | =EDATE(start, months) | A date serial | Renewal dates, payment schedules |
| NETWORKDAYS | Working days between two dates | =NETWORKDAYS(start, end, [holidays]) | A whole number of working days | SLA timers, project durations |
All four return numbers internally. A date is stored as a serial number, where 1 is 1 January 1900 in the default Windows system. Formatting turns the serial into something readable. If a formula returns a number such as 45800 where you expected a date, the cell is formatted as General, not as a date. Select the cell, choose a date format, and the value will display correctly.

Skip the setup
Waypost Gantt Chart and Project Tracker
Tasks, owners and dates that draw their own Gantt bars. Change a date and the timeline moves.
Terms used in this guide
These terms appear throughout, so it helps to fix their meaning first.
- Serial number: the integer Excel uses to store a date. Subtracting two serials gives the number of days between them.
- Volatile function: a function that recalculates every time the workbook recalculates, not only when its inputs change. TODAY is volatile.
- Inclusive count: a count that includes both the start and end dates. NETWORKDAYS counts both ends.
- End-of-month clamping: the behaviour where EDATE moves 31 January to 28 February, rather than to a non-existent date.
- Holiday range: a list of dates, one per cell, that NETWORKDAYS should treat as non-working.
- Weekend string: a seven-character code used by NETWORKDAYS.INTL to define which days are non-working.
TODAY: the date that moves
TODAY takes no arguments. Its brackets must still be included: =TODAY(). It returns the date on which the workbook last calculated, with no time component.
The most common use is a live countdown. If a deadline sits in B2, =B2-TODAY() returns the days remaining. A negative result means the deadline has passed. Pair it with conditional formatting so overdue rows turn red without anyone reading the numbers.
What TODAY does not do
TODAY does not store a date. It stores the formula. A report saved in March and opened in June will show June’s figures, because the formula recalculates on opening. For an audit trail, a fixed snapshot is safer. Enter the date manually with Ctrl+; (on Windows) or paste the value of the formula, so the record reflects the day it was made.
NOW is the related function. It returns the date and time, and it is also volatile. Use TODAY when you only need the day, because mixing time values into day counts produces fractional results that look like errors.
The cost of volatility
Because TODAY recalculates constantly, thousands of TODAY formulas in a large model add to recalculation time. The effect is usually small on a few hundred rows. It becomes noticeable when TODAY feeds chains of other volatile functions such as INDIRECT or OFFSET across a large workbook. The fix is to place TODAY in a single cell, usually labelled “Report date”, and point every other formula at that cell. One volatile cell is cheap. Thousands of them are not.
DATEDIF: elapsed time in years, months and days
DATEDIF returns the number of complete units between a start date and an end date. Its syntax is =DATEDIF(start_date, end_date, unit), where unit is a text string in quotation marks.
| Unit | Returns | Example result for 15 June 2015 to 10 March 2025 |
|---|---|---|
| “Y” | Complete years | 9 |
| “M” | Complete months | 117 |
| “D” | Total days | 3556 |
| “YM” | Months after the last complete year | 8 |
| “MD” | Days after the last complete month | 23 |
| “YD” | Days after the last complete year | 268 |
Combining “Y”, “YM” and “MD” gives a readable age or tenure: =DATEDIF(A2,TODAY(),"Y")&" years, "&DATEDIF(A2,TODAY(),"YM")&" months, "&DATEDIF(A2,TODAY(),"MD")&" days". For the example above, that returns “9 years, 8 months, 23 days”.
DATEDIF is undocumented
DATEDIF is missing from the function wizard and from Microsoft’s function reference list, though it works in current versions of Excel for Windows and Mac, and in Google Sheets and LibreOffice. You can type it directly. Anyone who opens the file will see it work, but a colleague searching the function list will not find it. Add a note beside the formula saying what it does.
If the start date is later than the end date, DATEDIF returns #NUM!. This is one of the few date errors that announces itself, so it is useful as a validation signal.
The “MD” trap
The “MD” unit has a known problem. It calculates days by subtracting the day-of-month values and ignores the month, which can produce wrong results when the end date’s day number is smaller than the start date’s. A start of 31 January and an end of 1 March can return a figure that does not match a manual count. For this reason, many spreadsheet specialists avoid “MD” and calculate the remaining days directly: =end_date-EDATE(start_date, DATEDIF(start_date,end_date,"M")). This subtracts the last complete month boundary from the end date and returns a result that matches a calendar count.
EDATE: moving a date by whole months
EDATE returns the date that falls a given number of months before or after a start date. =EDATE(A2, 12) returns the date one year on. =EDATE(A2, -3) returns the date three months earlier.
Common uses include renewal dates, subscription end dates, probation periods and loan repayment schedules. A 24-month contract starting on 1 April 2025 ends with =EDATE(B2,24), which returns 1 April 2027.
End-of-month clamping
EDATE keeps the day of the month where it can. Where the target month is shorter, it moves to the last day of that month. This is the most frequently misunderstood behaviour.
=EDATE(DATE(2025,1,31),1)returns 28 February 2025.=EDATE(DATE(2024,1,31),1)returns 29 February 2024, because 2024 is a leap year.=EDATE(DATE(2025,1,30),1)also returns 28 February 2025.
For a payment due on the last day of each month, use EOMONTH instead. =EOMONTH(A2, 1) returns the last day of the following month, whatever the start day was. Choose EDATE when the anniversary day matters, and EOMONTH when the period end matters.
Other EDATE details
EDATE truncates decimal months, so 2.9 is treated as 2. If the start date is text rather than a real date, EDATE returns #VALUE!. A start date typed as “15 March 2025” may look correct but be stored as text if the regional settings did not recognise it. Check with =ISNUMBER(A2), which should return TRUE for a genuine date.
Ready-made template
Clockbay Timesheet and PTO Tracker
Hours, overtime and time off for a small team, with the totals worked out for you every pay period.
NETWORKDAYS: counting working days
NETWORKDAYS counts the days between two dates that fall Monday to Friday, excluding any dates on a holiday list. Its syntax is =NETWORKDAYS(start_date, end_date, [holidays]).
The count is inclusive. If the start date is Monday 3 March 2025 and the end date is Friday 14 March 2025, the result is 10, because two working weeks of five days each are counted, including both end dates. If a public holiday falls on Wednesday 5 March and is listed, the result drops to 9.
Setting up the holiday list
Put holidays in a single column, each as a real date, on a separate sheet named something like “Calendar”. Name the range so formulas stay readable. Select the range, type a name such as UKHolidays in the Name Box, and press Enter. Then use =NETWORKDAYS(A2,B2,UKHolidays).
Three rules keep the list working:
- Enter every date with DATE(year,month,day) or a verified date format, not as text.
- Include only the days that are actually non-working for your team. Adding a company-wide closure only for one office will distort everyone else’s counts.
- Review the list each year. A list that stops at the previous year returns plausible but wrong counts for the new one.
NETWORKDAYS.INTL for other working weeks
Not every organisation works Monday to Friday. Retail teams often work Sunday to Thursday, and some shift patterns have two rest days in the middle of the week. NETWORKDAYS.INTL covers these cases.
Its syntax is =NETWORKDAYS.INTL(start_date, end_date, weekend, [holidays]). The weekend argument can be a number or a seven-character string:
- Number 1 (default) means Saturday and Sunday are non-working.
- Number 11 means Sunday only is non-working.
- Number 12 means Monday only is non-working.
- A string such as “0000011” means the same as number 1. Each character represents one day, starting with Monday. A 1 marks a non-working day, and a 0 marks a working day.
For a Sunday to Thursday week, with Friday and Saturday off, the string is “0000110”. Read it as Monday 0, Tuesday 0, Wednesday 0, Thursday 0, Friday 1, Saturday 1, Sunday 0. Wait, that gives Sunday as working, which is the intended result for a Sunday to Thursday pattern, so the string is correct. Test any custom string against a week you can count by hand before trusting it.
How to choose between the four functions
Work through these questions in order.
- Does the answer need to be a date or a number? If a date, use TODAY or EDATE. If a number, use DATEDIF or NETWORKDAYS.
- If a number, what unit? Calendar years, months or days point to DATEDIF. Working days point to NETWORKDAYS or NETWORKDAYS.INTL.
- Should the result change every day? Use TODAY, and place it in one named cell if the file is large. If the result should stay fixed, paste the value.
- Does the period end on a fixed day of the month? Use EOMONTH rather than EDATE.
- Do public holidays or non-standard weekends affect the count? Use NETWORKDAYS with a holiday range, or NETWORKDAYS.INTL with a weekend string.
Combine functions where a single one cannot answer the question. For example, a contract review date might be =EDATE(start,12)-14, which takes the anniversary and moves back two weeks. For a deadline expressed in working days, =WORKDAY(start, 10, UKHolidays) returns the date ten working days after the start, which is the reverse of NETWORKDAYS.
Worked example: a contract tracker
The following setup tracks a set of supplier contracts. Each row holds a start date, a term in months, a holiday list and a report date. The steps and formulas below can be copied directly.
Step 1. Create three columns on a sheet called “Contracts”: Supplier (A), Start date (B), Term in months (C).
Step 2. In a sheet called “Calendar”, list the holiday dates in column A from A2 downwards. Name the range UKHolidays.
Step 3. In a cell on the Contracts sheet, enter the report date: =TODAY(). Name the cell ReportDate. This is the only volatile formula in the tracker.
Step 4. In column D, calculate the end date: =EDATE(B2,C2). Format the column as a date.
Step 5. In column E, calculate days remaining to the end date: =D2-ReportDate. A negative value means the contract has expired.
Step 6. In column F, calculate the working days elapsed since the start: =NETWORKDAYS(B2,ReportDate,UKHolidays).
Step 7. In column G, show the contract age: =DATEDIF(B2,ReportDate,"Y")&" yrs, "&DATEDIF(B2,ReportDate,"YM")&" mths".
Step 8. Add conditional formatting to column E so cells below 30 turn amber and cells below zero turn red.
Using a sample row with a start date of DATE(2025,3,3), a term of 12 months and a report date of 10 March 2025, the outputs are:
| Column | Formula result | Meaning |
|---|---|---|
| D (End date) | 3 March 2026 | Contract end |
| F (Working days elapsed) | 6 | Monday 3 to Monday 10 March, inclusive, with weekends excluded |
| G (Age) | 0 yrs, 0 mths | Under one complete month |
Add a holiday on 5 March 2025 to the Calendar sheet, and F drops to 5. The tracker updates without any edits to the formulas. That is the point of building it with a holiday range rather than hard-coded figures.
Checklist before a date formula goes into a shared file
Run through these points before the workbook leaves your desk.
- Every input date returns TRUE from
ISNUMBER. - Every date result is formatted as a date, not a number.
- The report date is in one named cell, and TODAY appears only there if possible.
- The holiday range is named, populated, and dated for the current and next year.
- Start and end arguments are in the correct order for every DATEDIF and NETWORKDAYS formula.
- Blank rows return blank results rather than 1900 dates or large counts.
- Any custom weekend string has been tested against a week counted by hand.
- A note on the sheet explains the unit and the convention used, particularly for DATEDIF and EDATE.
The decision rule to keep
When you are unsure, ask what the reader will do with the number. If they will act on a deadline, count working days with NETWORKDAYS and a holiday list. If they will report an age or tenure, use DATEDIF with the “Y”, “YM” and “MD” units, and check the result against a manual count once. If they need a renewal date, use EDATE, or EOMONTH where the period ends on the last day of a month. If the answer must update daily, put TODAY in a single named cell and point everything else at it.
