How-to Guide 5 min read

How to Calculate Days Between Two Dates in Excel (DAYS, NETWORKDAYS)

Count days between two dates in Excel with subtraction, DAYS or DATEDIF, count working days with NETWORKDAYS, and fix #VALUE!, #NUM! and off-by-one errors.

days between two dates excelexcel days functionnetworkdays excelexcel date difference in daysdatedif days

The short answer

To count days between two dates in Excel, subtract them: =B2-A2, where A2 is the start date and B2 the end date. =DAYS(B2,A2) gives the same result (note the end date comes first). For working days, use =NETWORKDAYS(A2,B2), which skips Saturdays and Sundays and counts both end dates. Add +1 to a subtraction if you need an inclusive count. To double-check a single answer without a spreadsheet, use the Date Difference Calculator.

Method 1: subtract the dates

Excel stores every date as a serial number (one per day), so subtracting two dates gives the number of days between them.

  • Put the start date in A2, for example 27-Oct-2026.
  • Put the end date in B2, for example 31-Dec-2026.
  • In C2 type =B2-A2.
  • If the result appears as a date, change the cell format to Number or General.
  • The result is 65. This is an exclusive count: it measures the gap from the start date to the end date, so the start date itself is not counted. For a "both days included" count, use =B2-A2+1, which gives 66.

    Method 2: the DAYS function

    =DAYS(end_date, start_date)

    The end date comes first. With the same dates, =DAYS(B2,A2) returns 65. DAYS is available in Excel 2016 and later, including Microsoft 365. It is useful when dates arrive as text that Excel can read, because DAYS converts text dates in the same way DATEVALUE does. Swapping the arguments gives a negative number, which is a quick way to spot a reversed formula.

    Method 3: DATEDIF with "d"

    =DATEDIF(start_date, end_date, "d")

    DATEDIF takes the start date first and returns full days. =DATEDIF(A2,B2,"d") also gives 65. Two cautions from Microsoft's own documentation:

    • If the start date is later than the end date, DATEDIF returns #NUM!.
    • Microsoft does not recommend the "md" unit (days left over after whole months) because it can give inaccurate results.

    DATEDIF is most useful when you want years, months and days separately, as in an age calculation. For that, see How to Calculate Age in Excel (DATEDIF Formula, Years Months Days).

    Counting working days with NETWORKDAYS

    =NETWORKDAYS(start_date, end_date, [holidays])

    NETWORKDAYS counts Monday to Friday and leaves out Saturdays and Sundays. Unlike subtraction, it includes both the start and end dates when they are weekdays.

    FormulaResult for 27-Oct-2026 to 31-Dec-2026
    =B2-A265
    =DAYS(B2,A2)65
    =B2-A2+166
    =NETWORKDAYS(A2,B2)48
    =NETWORKDAYS(A2,B2,H2) with 25-Dec-2026 in H247
    =NETWORKDAYS.INTL(A2,B2,11)57

    Adding holidays

    List your holiday dates in a range, for example H2:H15, and pass it as the third argument: =NETWORKDAYS(A2,B2,H2:H15). Holidays that fall on a weekend are not subtracted twice. In the example, 25 December 2026 is a Friday, so listing it drops the count from 48 to 47.

    Use a fixed reference such as $H$2:$H$15 if you copy the formula down a column, otherwise the range shifts row by row.

    Different weekends: NETWORKDAYS.INTL

    =NETWORKDAYS.INTL(start_date, end_date, [weekend], [holidays])

    The weekend argument lets you choose which days are off:

    Weekend codeDays off
    1 (default)Saturday and Sunday
    2Sunday and Monday
    7Friday and Saturday
    11Sunday only
    17Saturday only

    For a six-day working week with only Sunday off, use code 11. With the example dates that gives 57 working days. You can also pass a seven-character text string, one character per day starting Monday, where 1 means a day off: "0000011" is the same as code 1, and "0000001" is Sunday only.

    Checking your answer

    It is easy to be off by one, so check at least one result independently:

  • Open the Date Difference Calculator.
  • Enter the same start and end dates.
  • Compare the Days figure with your Excel subtraction. For 27 October to 31 December 2026 both give 65.
  • The calculator also shows the gap in weeks, months, years, hours and minutes, which helps when you are not sure whether a result looks reasonable. For the inclusive versus exclusive question in more depth, read How to Calculate Days Between Two Dates (Inclusive or Not).

    Troubleshooting

    • The result shows as a date (like 05-Mar-1900). The cell is formatted as a date. Change it to Number or General.
    • #VALUE! One of the "dates" is text Excel cannot read, often from a CSV export or a different date order (day-month vs month-day). Re-enter the date or convert it with DATEVALUE or Data > Text to Columns.
    • #NUM! from DATEDIF. The start date is after the end date. Swap them.
    • A negative number. You subtracted the later date from the earlier one, or put DAYS arguments in the wrong order.
    • The count is one off. Decide whether you need inclusive or exclusive days. Subtraction and DAYS are exclusive; NETWORKDAYS is inclusive.
    • Times are included. If cells contain a date and a time, subtraction gives a decimal. Wrap it in INT, for example =INT(B2-A2), for whole days.

    Common uses

    • Notice periods and deadlines. Add days to a date with =A2+90. For example, 27-Oct-2026 + 90 is 25-Jan-2027.
    • Invoice ageing. =TODAY()-A2 shows how many days an invoice has been outstanding. It updates every day the file is opened.
    • Project schedules. NETWORKDAYS with a holiday list gives the working days available for a task.

    Google Sheets supports the same subtraction method and the DAYS, DATEDIF, NETWORKDAYS and NETWORKDAYS.INTL functions, so these formulas generally work there too.

    Frequently asked questions

    What is the formula for days between two dates in Excel?

    Subtract the earlier date from the later one, for example =B2-A2, or use =DAYS(B2,A2), where B2 is the end date. Both return the number of days between them, not counting the start date.

    Does NETWORKDAYS include the start and end date?

    Yes. NETWORKDAYS counts both the start date and the end date if they are working days, which is why its result is usually one higher than a simple subtraction on a weekday-only range.

    How do I count working days with a Sunday-only weekend in Excel?

    Use NETWORKDAYS.INTL with weekend code 11, for example =NETWORKDAYS.INTL(A2,B2,11,H2:H10). Code 11 treats only Sunday as non-working.

    Why does my Excel date formula show #VALUE!?

    Usually one of the dates is stored as text rather than a real date. Re-enter it, or convert it with DATEVALUE or Text to Columns, so Excel recognises it as a date.

    How do I count days including both the start and end date?

    Add 1 to the result: =B2-A2+1 or =DAYS(B2,A2)+1.

    Try this tool on Lazyblink

    Put this guide into practice with our free online tool — no signup required.

    Open tool