To calculate the number of days between two dates in Excel, put the start date in one cell and the end date in another, then subtract the earlier date from the later one: =B2-A2 (end date minus start date). You can also use =DAYS(B2,A2), which gives the same answer. If you want only workdays, use =NETWORKDAYS(A2,B2), and add a list of holidays if your schedule has them. If the result shows up as a strange date such as 2/13/1900, change the cell’s format to General or Number.
The rest of this guide walks through each method, explains which one to choose, and shows how to count inclusive days, days until a deadline, weeks, months and years, plus how to fix the errors people run into most often.
What you need and which versions this covers
These steps work in Excel for Microsoft 365 on Windows and Mac, Excel for the web, and Excel 2024, 2021, 2019 and 2016. Every function in this guide is listed in Microsoft’s current date and time functions reference. Menu names are from the current Microsoft 365 version on Windows. On a Mac, the ribbon looks almost the same, and you press Command + 1 instead of Ctrl + 1 to open Format Cells.
You need two things:
- Two real dates. Excel must recognize both entries as dates, not text. A real date is normally right-aligned in the cell. A date that is stored as text is usually left-aligned, and formulas will either fail or return the wrong answer.
- An empty cell for the result. This is where you type the formula.
Why subtraction works: Excel stores every date as a serial number, which is a count of days. In the default 1900 date system, January 1, 1900 is serial number 1, and March 2, 2026 is 46083. When you subtract one date from another, Excel is simply subtracting two numbers, so the answer is the number of days between them.
Which method should you use?
| What you want to count | Formula to use | Notes |
|---|---|---|
| Calendar days between two dates | =B2-A2 or =DAYS(B2,A2) |
Counts weekends and holidays. Does not count the start day. |
| Calendar days including both the start and end day | =B2-A2+1 |
Useful for rentals, leave requests and billing periods. |
| Days from a date until today | =TODAY()-A2 |
Updates automatically each day. |
| Weekdays only (Monday to Friday) | =NETWORKDAYS(A2,B2) |
Counts the start and end dates if they are weekdays. |
| Weekdays minus holidays | =NETWORKDAYS(A2,B2,$F$2:$F$6) |
F2:F6 holds the holiday dates. |
| Workdays with a different weekend | =NETWORKDAYS.INTL(A2,B2,7) |
7 means Friday and Saturday are the weekend. |
| Complete months or years | =DATEDIF(A2,B2,"m") or "y" |
Start date must be earlier than the end date. |
In all of these examples, the start date is in A2 and the end date is in B2 unless the example says otherwise.
Method 1: Subtract one date from the other
This is the quickest method and the one most people should start with. It returns the number of calendar days between the dates.
Step 1: Enter the start and end dates
Type the start date in one cell, such as B2, and the end date in the cell next to it, such as C2. Use a format Excel recognizes for your region, for example 3/2/2026 in the US. When you press Enter, the date should line up on the right side of the cell. If you need help with date entry or shortcuts, see our guide on how to insert a date and time in Excel.
Step 2: Click the cell where you want the answer
Select an empty cell in the same row, such as D2. You might label the column above it “Days” so the result is easy to understand later.
Step 3: Type the subtraction formula
Type =C2-B2 and press Enter. Always put the later date first. With a start date of 3/2/2026 and an end date of 4/15/2026, Excel shows 44. If the dates are reversed, you get a negative number, which tells you the end date is earlier than the start date.

Step 4: Check the result format
Excel sometimes formats the answer as a date because the formula uses date cells. If you see something like 2/13/1900 instead of 44, the math is right but the display is wrong. Select the cell, go to Home, open the Number Format drop-down in the Number group, and choose General or Number. The cell then shows the plain day count.

Step 5: Copy the formula to other rows
If you have more pairs of dates below, select D2 and drag the fill handle (the small square at the bottom-right corner of the cell) down the column, or double-click it. Excel adjusts the cell references for each row, so D3 becomes =C3-B3, and so on.
Counting both the first and last day: Subtraction measures the gap between the dates, so a start and end date on the same day gives 0. If the first day counts, as it does for an equipment rental billed per day or a vacation request, add 1: =C2-B2+1. For March 2 through April 15, 2026, that gives 45.
Method 2: Use the DAYS function
The DAYS function does the same thing as subtraction, but its name makes the purpose of the formula clear to anyone who opens the workbook later. Its syntax is:
=DAYS(end_date, start_date)
Note the order: the end date comes first. That is the opposite of most other date functions, so it’s an easy mistake to make.
- Click the cell where you want the answer.
- Type
=DAYS(C2,B2), where C2 is the end date and B2 is the start date. - Press Enter. Excel shows the same result as subtraction, such as 44.
If you prefer menus to typing, go to Formulas > Date & Time and choose DAYS. The Function Arguments box opens with an End_date field and a Start_date field. Click into each field, click the matching cell on the sheet, and then select OK.
You can also type dates straight into the function inside quotation marks, such as =DAYS("4/15/2026","3/2/2026"). Excel converts the text the same way the DATEVALUE function does, so the dates must be in a format your regional settings understand. For the US, use month/day/year. Typed dates are fine for a one-off check, but cell references are easier to update.
According to Microsoft, DAYS returns #VALUE! when a date can’t be read as a valid date and #NUM! when a number is outside Excel’s valid date range.
Method 3: Use DATEDIF for days, months and years
DATEDIF (short for “date difference”) is an older function that Excel keeps so workbooks from Lotus 1-2-3 still work. Microsoft documents it, but you may not see it suggested while you type the formula, so type the whole name yourself. Its syntax is:
=DATEDIF(start_date, end_date, unit)
Unlike DAYS, DATEDIF takes the start date first. The unit is a code in quotation marks:
| Unit | What it returns |
|---|---|
"d" |
Number of days between the dates |
"m" |
Number of complete months |
"y" |
Number of complete years |
"ym" |
Months left over after the complete years |
"yd" |
Days between the dates as if they were in the same year |
"md" |
Days left over after complete months (Microsoft advises against using it) |
For a plain day count, =DATEDIF(A2,B2,"d") gives the same number as subtraction. The real reason to use DATEDIF is months and years.
Two warnings before you rely on DATEDIF:
- If the start date is later than the end date, DATEDIF returns #NUM! instead of a negative number. Subtraction and DAYS return negative numbers in the same situation.
- Microsoft’s DATEDIF function page says the
"md"unit can return a negative number, zero or an inaccurate result. Use the alternative below instead.
Show the result as years, months and days
To show a length of service or an age like “7 years, 2 months, 20 days,” combine three pieces. With a start date of 8/14/2019 in A2 and an end date of 11/3/2026 in B2:
- Years:
=DATEDIF(A2,B2,"y")returns 7. - Months left over:
=DATEDIF(A2,B2,"ym")returns 2. - Days left over:
=B2-EDATE(A2,DATEDIF(A2,B2,"m"))returns 20. EDATE moves the start date forward by the total number of complete months (86), which lands on 10/14/2026, and the subtraction counts the remaining days.
To put it all in one cell, join the pieces with the ampersand (&):
=DATEDIF(A2,B2,"y")&" years, "&DATEDIF(A2,B2,"ym")&" months, "&B2-EDATE(A2,DATEDIF(A2,B2,"m"))&" days"
Microsoft’s own example uses B2-DATE(YEAR(B2),MONTH(B2),1) for the last piece. That counts days since the first of the end date’s month, which matches the true remainder only when the start date falls on the 1st. The EDATE version counts from the last monthly anniversary, so it works for any start date.
Weeks between two dates
Divide the day count by 7: =(B2-A2)/7. For March 2 to April 15, 2026, that’s 6.29 weeks. Format the cell as Number with two decimal places, or wrap the formula in INT to get whole weeks only: =INT((B2-A2)/7) returns 6.
Count days from or until today
The TODAY function returns the current date, so you can use it in place of either date:
- Days since a date (how long an invoice has been open):
=TODAY()-A2 - Days until a date (a deadline or event):
=A2-TODAY()
A negative result in the “days until” formula means the date has already passed. If you’d rather show 0 than a negative number, use =MAX(0,A2-TODAY()).
Keep in mind that TODAY changes every day. The workbook will show a different answer tomorrow, which is usually what you want for a countdown but not for a record you want to keep. If you need a fixed date, press Ctrl + ; to type today’s date as a value instead. If the result doesn’t change from one day to the next, the workbook may be set to manual calculation. See how to switch between manual and automatic calculation in Excel to check.
Count only workdays with NETWORKDAYS
NETWORKDAYS counts whole working days between two dates. It skips Saturdays and Sundays automatically, and it can also skip a list of holidays. Unlike subtraction, it counts both the start date and the end date when they fall on weekdays. Its syntax is:
=NETWORKDAYS(start_date, end_date, [holidays])
Step 1: List your holidays (optional)
In a spare column or another sheet, type each holiday date in its own cell, such as F2 through F6. Make sure they are real dates, not text. List every year your date ranges cover, because Excel doesn’t know any holidays on its own.
Step 2: Type the formula
In the result cell, type =NETWORKDAYS(B2,C2,$F$2:$F$6) and press Enter. The dollar signs make the holiday range an absolute reference, so it stays the same when you copy the formula down. You can add them quickly by selecting the range in the formula and pressing F4.
Step 3: Copy it down and check the results
Drag the fill handle down the column. Each row now shows the weekdays between its dates, minus any holidays that fall inside the range. If you don’t have holidays, leave out the third argument: =NETWORKDAYS(B2,C2).

A tip for a tidier workbook: select your holiday cells, go to Formulas > Define Name, and name the range something like Holidays. Then your formula can read =NETWORKDAYS(B2,C2,Holidays), which is easier to read and can’t shift by accident.
Count weekend days
To find how many weekend days are in a range, take the inclusive day count and subtract the workdays: =C2-B2+1-NETWORKDAYS(B2,C2). For March 2 to April 15, 2026, that is 45 – 33 = 12 weekend days.
Custom weekends with NETWORKDAYS.INTL
If your weekend isn’t Saturday and Sunday, use NETWORKDAYS.INTL. It adds a weekend argument before the holidays:
=NETWORKDAYS.INTL(start_date, end_date, [weekend], [holidays])
The weekend argument can be a number from Microsoft’s list:
| Number | Weekend days |
|---|---|
| 1 or omitted | Saturday, Sunday |
| 2 | Sunday, Monday |
| 3 | Monday, Tuesday |
| 4 | Tuesday, Wednesday |
| 5 | Wednesday, Thursday |
| 6 | Thursday, Friday |
| 7 | Friday, Saturday |
| 11 to 17 | A single day: 11 is Sunday only, 12 Monday only, and so on through 17 for Saturday only |
For any other pattern, use a seven-character text string in quotation marks. Each character stands for a day, starting with Monday, where 1 means a day off and 0 means a workday. Some useful examples:
"0000011"is the normal Saturday and Sunday weekend."0000001"is a six-day week with only Sunday off."1010111"counts only Tuesdays and Thursdays, handy for a part-time schedule."0111111"counts only Mondays. With March 2 to April 15, 2026,=NETWORKDAYS.INTL(B2,C2,"0111111")returns 7, the number of Mondays in that range.
The string must be exactly seven characters of 1s and 0s, or the function returns #VALUE!. A string of all 1s returns 0. If the start date is later than the end date, NETWORKDAYS.INTL returns a negative number.
Worked example with sample data
Here is how the methods compare for four projects. The holiday list contains 5/25/2026, 7/3/2026, 9/7/2026, 11/26/2026 and 11/27/2026.
| Project | Start | End | =C-B | =C-B+1 | NETWORKDAYS | NETWORKDAYS with holidays |
|---|---|---|---|---|---|---|
| Website redesign | 3/2/2026 | 4/15/2026 | 44 | 45 | 33 | 33 |
| Office move | 5/18/2026 | 7/6/2026 | 49 | 50 | 36 | 34 |
| Annual audit | 9/8/2026 | 9/25/2026 | 17 | 18 | 14 | 14 |
| Holiday campaign | 11/2/2026 | 12/23/2026 | 51 | 52 | 38 | 36 |
A few things to notice. The office move loses two workdays to Memorial Day and the July 3 holiday, while the audit loses none because Labor Day (9/7) falls the day before it starts. The holiday campaign loses Thanksgiving and the day after. If you used =NETWORKDAYS.INTL(B3,C3,7,$F$2:$F$6) for the office move to treat Friday and Saturday as the weekend, the answer would be 35 instead of 34. Sundays now count as workdays, Fridays don’t, and the July 3 holiday no longer lowers the total because it falls on a Friday, which is already a day off.
Troubleshooting
The result looks like a date
Change the result cell to General or Number from Home > Number Format, or press Ctrl + 1 and choose Number. The value itself is correct.
#VALUE! error
At least one of the dates is text that Excel can’t read as a date. Signs of this include the date sitting on the left side of the cell or a small green triangle in its corner. Re-type the date, or convert it with =DATEVALUE(A2) and format the result as a date. Dates imported from other systems often need converting this way. Also check that the day and month aren’t swapped for your region.
#NUM! error
With DATEDIF, this almost always means the start date is later than the end date. Swap the cells in the formula. With DAYS or NETWORKDAYS.INTL, #NUM! means a date is outside the range Excel can handle.
#NAME? error
The function name is misspelled, or a unit such as d is missing its quotation marks. Check the spelling, for example DATEDIF, not DATEDIFF.
A negative number
The dates are the wrong way around. Either swap them or, if you only care about the size of the gap, wrap the formula in ABS: =ABS(C2-B2).
The formula shows instead of the answer
The cell was formatted as Text before you typed the formula, or Show Formulas is turned on. Our guide on why Excel shows formulas instead of results covers both fixes.
The answer is off by one
Decide whether you need inclusive counting. Subtraction, DAYS and DATEDIF don’t count the start day. NETWORKDAYS counts both ends. Add 1 to subtraction results when both days should count.
The answer is off by about four years
Excel supports two date systems. Workbooks that use the 1904 date system, which was the default in older Excel for Mac versions, store dates 1,462 days lower than the 1900 system. If you copy dates between workbooks that use different systems, they can shift by four years and one day. You can check the setting at File > Options > Advanced under When calculating this workbook, where the Use 1904 date system box should normally be cleared. Two dates in the same workbook always use the same system, so subtracting them still gives the right number of days.
Frequently Asked Questions
What is the easiest formula for days between two dates in Excel?
Subtract the start date from the end date, such as =B2-A2. It counts calendar days, including weekends, and doesn’t count the start day. Add 1 if you want both days included.
Is DAYS better than subtracting the dates?
They return the same result for real dates. DAYS makes the formula easier to understand at a glance and can convert dates typed as text in quotation marks. Remember that DAYS takes the end date first.
Why doesn’t DATEDIF appear when I start typing it?
DATEDIF is a compatibility function carried over from Lotus 1-2-3, and you may not see it in the formula suggestions or in the Formulas > Date & Time menu. It still works if you type the full formula, including the unit in quotation marks.
How do I count business days without weekends and holidays?
Use =NETWORKDAYS(A2,B2,H2:H10), where H2:H10 contains your holiday dates. It excludes Saturdays, Sundays and every listed holiday, and it counts the start and end dates if they are workdays.
How do I calculate someone’s age in years?
Use =DATEDIF(A2,TODAY(),"y"), where A2 holds the date of birth. It returns complete years, so the number goes up on the birthday itself.
Does this work in Excel for the web and on a Mac?
Yes. Subtraction, DAYS, DATEDIF, TODAY, NETWORKDAYS and NETWORKDAYS.INTL all work in Excel for the web and Excel for Mac. On a Mac, use Command + 1 to open Format Cells.
Can I count days between dates and times?
Yes. Subtracting two cells that contain both a date and a time gives days plus a fraction of a day. To show the total as hours and minutes, format the result with the custom format [h]:mm. To get whole days only, use =INT(B2-A2).
Does Excel handle leap years?
Yes. Because dates are stored as day counts, February 29 is counted automatically. The only known quirk is that Excel treats 1900 as a leap year for compatibility with Lotus 1-2-3, which Microsoft says only affects WEEKDAY results for dates before March 1, 1900.
Next steps
For most tasks, start with simple subtraction, add 1 if both days should count, and switch to NETWORKDAYS when weekends and holidays shouldn’t be included. Microsoft’s guide to calculating the difference between two dates and its NETWORKDAYS.INTL function reference have more examples if you need them.

Kermit Matthews runs Live2Tech from just outside Philadelphia. He is an IT specialist with over 20 years of experience, from a university help desk to small-business IT, IT management and his own consulting practice, and has written tech guides full time since 2020. Steps are checked against the current software on a real device or the maker’s official documentation. More about Kermit.