smtp.compagnie-des-sens.fr
EXPERT INSIGHTS & DISCOVERY

days between two dates in excel

smtp

S

SMTP NETWORK

PUBLISHED: Mar 27, 2026

Days Between Two Dates in Excel: A Complete Guide to Calculating Date Differences

days between two dates in excel is a common task for anyone working with spreadsheets, whether you're tracking project timelines, calculating employee tenures, or analyzing sales periods. Understanding how to efficiently calculate the difference between dates in Excel can save you time and help ensure accuracy in your data analysis. If you've ever found yourself wondering how to subtract one date from another or how to get the number of days between two given dates, this guide will walk you through all the essential methods and tips to master this task.

Understanding Date Formats and Excel’s Date System

Before diving into formulas, it’s important to know how Excel handles dates. Excel stores dates as serial numbers, starting from January 1, 1900, which is serial number 1. Each subsequent day increases the number by 1. So, January 2, 1900, is serial number 2, and so on. This numeric system allows Excel to perform arithmetic operations on dates, like subtraction, to calculate durations.

If your dates aren’t recognized properly by Excel (for example, if they’re stored as text), your calculations might not work as expected. Ensuring your dates are in a proper date format is the first step toward calculating days between two dates in Excel successfully.

Simple Method: Subtracting Dates Directly

The most straightforward way to find the number of days between two dates is to subtract one date from the other. Suppose you have a start date in cell A1 and an end date in cell B1. You can use a simple formula:

=B1 - A1

This formula will give you the number of days between the two dates. Just make sure that both cells are formatted as dates. The result will be a number representing the days elapsed.

Example

A (Start Date) B (End Date) C (Days Between)
01/01/2024 01/15/2024 =B1-A1 → 14

This method is quick but be cautious if your dates are in a different order. If the end date is earlier than the start date, the result will be negative.

Using the DATEDIF Function for Flexible Date Calculations

Excel offers a hidden gem called the DATEDIF function, which stands for “date difference.” It calculates the difference between two dates and can return the result in days, months, or years, depending on the unit you specify.

The syntax is:

=DATEDIF(start_date, end_date, unit)

Where:

  • start_date is the beginning date.
  • end_date is the ending date.
  • unit defines the type of difference you want ("d" for days, "m" for months, "y" for years).

For calculating days between two dates in Excel, use:

=DATEDIF(A1, B1, "d")

Why Use DATEDIF?

  • It always returns a positive number if the end date is after the start date.
  • Allows you to calculate differences in months or years, which can be handy for age or service calculations.
  • Handles leap years and different month lengths accurately.

Calculating Workdays Between Dates

Sometimes, you don’t want the total days but the number of working days (weekdays) between two dates. Excel’s NETWORKDAYS function is perfect for this. It excludes weekends (Saturday and Sunday) and optionally, any holidays you specify.

Syntax:

=NETWORKDAYS(start_date, end_date, [holidays])
  • start_date and end_date are your date range.
  • [holidays] is an optional range of dates to exclude.

Example

If cell A1 has 01/01/2024 and B1 has 01/15/2024, and you want to exclude weekends:

=NETWORKDAYS(A1, B1)

This returns the count of weekdays between those dates.

Incorporating Holidays

To exclude holidays, list all holiday dates in a range, say D1:D5, and include it in the formula:

=NETWORKDAYS(A1, B1, D1:D5)

This feature is especially useful for project management and payroll where working days are critical.

Calculating Exact Time Differences Including Hours and Minutes

While days between two dates in Excel is often enough, there are situations when you need a more precise difference that includes hours, minutes, or even seconds.

If your date and time are combined (e.g., 01/01/2024 14:00), Excel still treats these as serial numbers, with the integer part representing the date and the decimal part representing the time.

To calculate the difference including time:

=B1 - A1

Then, format the result cell as a custom format like:

d "days" h "hours" m "minutes"

Or, to get the total hours difference:

=(B1 - A1) * 24

This multiplies the day difference by 24 hours.

Handling Negative Date Differences and Errors

When calculating days between two dates in Excel, you might run into negative values if the end date is earlier than the start date. Sometimes, this is expected; other times, it might be an error.

To avoid negative results, especially with the simple subtraction method, you can use the ABS function:

=ABS(B1 - A1)

This formula returns the absolute value of the difference, ensuring a positive number. However, with DATEDIF, if the start date is after the end date, it will return an error, so you’ll want to ensure correct date order or use error handling like IFERROR.

Tips for Working Efficiently with Date Differences in Excel

  • Ensure correct date formatting: Always double-check that your dates are recognized by Excel as dates and not text to avoid calculation errors.
  • Use named ranges for holidays: If you frequently calculate workdays excluding holidays, define a named range for your holiday list to simplify formulas.
  • Consider time zones and daylight saving: For time-sensitive calculations, be aware that Excel doesn’t automatically adjust for time zone changes or daylight saving time.
  • Combine functions for complex needs: You can nest functions, such as using IF to handle negative differences or wrapping NETWORKDAYS inside other formulas to create dynamic reports.
  • Use cell references: Avoid hardcoding dates in formulas to make your spreadsheet flexible and easy to update.

Alternative Methods Using Excel Add-Ins and Power Query

For users working with large datasets or needing more advanced date calculations, Excel’s Power Query tool offers a robust alternative. You can import your data into Power Query and easily calculate date differences with built-in date/time functions, which is especially useful for cleaning and preparing data before analysis.

Similarly, some Excel add-ins provide enhanced date calculation capabilities, including business day calculations that consider different country-specific holidays or custom workweeks.

Practical Applications of Calculating Days Between Dates

Understanding how to calculate days between two dates in Excel is invaluable across many fields:

  • Project Management: Track the duration between project milestones or deadlines to monitor progress.
  • Human Resources: Calculate employee tenure, probation periods, or leave balances.
  • Finance: Determine interest accrual periods or invoice due dates.
  • Sales and Marketing: Analyze campaign durations or product delivery times.

By mastering these date functions, you can enhance your data analysis capabilities and make smarter, data-driven decisions.


Whether you’re a beginner or looking to refine your Excel skills, understanding how to calculate days between two dates in Excel opens up many possibilities. With functions like simple subtraction, DATEDIF, NETWORKDAYS, and advanced tools like Power Query, you can tailor your approach to fit your specific needs and handle almost any date-related calculation with confidence.

In-Depth Insights

Days Between Two Dates in Excel: A Comprehensive Guide to Date Calculations

days between two dates in excel is a common requirement for professionals across various industries—from project managers tracking deadlines to financial analysts calculating interest periods. Microsoft Excel, as one of the most widely used spreadsheet tools, offers multiple methods to compute the number of days separating two dates. This seemingly simple task can vary in complexity depending on the desired level of precision, inclusion or exclusion of weekends and holidays, and the format of the dates themselves. Understanding these nuances is essential for accurate reporting, forecasting, and data analysis.

Excel’s flexibility allows users to perform date calculations with built-in functions, formulas, and add-ins, catering to a broad spectrum of use cases. Analyzing these options reveals not only how to extract the difference in days but also how to customize calculations according to business rules or project specifications. This article explores the various techniques to calculate days between two dates in Excel, comparing their features, advantages, and potential pitfalls.

Understanding Excel’s Date System

Before delving into calculation methods, it is important to clarify how Excel interprets dates. Excel stores dates as serial numbers starting from January 1, 1900, which is assigned the value 1. Each subsequent day increments this number by one. For example, January 2, 1900, is 2, and so forth. This numerical representation allows for straightforward arithmetic operations on dates.

However, this serial number system also imposes certain constraints. Dates entered must be recognized by Excel’s date format; otherwise, calculations may produce errors or inaccurate results. Additionally, Excel’s default date system differs between Windows and Mac versions, though this is rarely an issue for typical date difference calculations.

Basic Formula for Calculating Days Between Two Dates

The most straightforward method to find the difference between two dates in Excel is to subtract the earlier date from the later date. For example, assuming the start date is in cell A1 and the end date in B1, the formula is:

=B1 - A1

This formula returns the number of days between the two dates, including both start and end dates as whole days apart. It’s essential that both cells contain valid date values; otherwise, the result may be nonsensical.

This approach is efficient and quick but lacks flexibility when excluding weekends or holidays, or when calculating working days only.

Using the DATEDIF Function

An often overlooked yet powerful function for date differences is DATEDIF. Although it is an undocumented feature in Excel, DATEDIF remains functional across versions. It is particularly useful because it offers different units of measurement—days, months, or years.

To calculate the number of days between two dates, the syntax is:

=DATEDIF(A1, B1, "d")

Here:

  • A1 is the start date.
  • B1 is the end date.
  • "d" specifies the unit as days.

DATEDIF provides more control and can also calculate complete months or years, making it superior for more complex date difference needs.

Advanced Calculations: Working with Business Days

In many professional settings, calculating calendar days is insufficient because projects and financial models often require consideration of working days only—that is, excluding weekends and holidays.

NETWORKDAYS and NETWORKDAYS.INTL Functions

Excel offers two primary functions tailored for this purpose:

  • NETWORKDAYS: Calculates the number of working days between two dates, automatically excluding weekends (Saturday and Sunday) and optionally excluding holidays.
  • NETWORKDAYS.INTL: An enhanced version that allows the user to define which days of the week are considered weekends, providing greater customization.

The basic syntax of NETWORKDAYS is:

=NETWORKDAYS(start_date, end_date, [holidays])
  • start_date and end_date define the period.
  • [holidays] is an optional range or array of dates to exclude.

For example, if holidays are listed in the range C1:C5, the formula becomes:

=NETWORKDAYS(A1, B1, C1:C5)

This method is invaluable for project management, payroll calculations, and any scenario where non-working days must be excluded.

NETWORKDAYS.INTL further allows specifying which days are weekends by using a weekend string or number. For instance, to consider Friday and Saturday as weekends instead of the default Saturday and Sunday, one can use:

=NETWORKDAYS.INTL(A1, B1, "0001100", C1:C5)

Where "0001100" is a string representing days of the week starting from Monday (0 = workday, 1 = weekend).

Pros and Cons of Using NETWORKDAYS Functions

  • Pros: Automatically excludes weekends and holidays, reducing manual adjustments; supports customizable weekend definitions (in NETWORKDAYS.INTL); easy to incorporate into larger financial or project models.
  • Cons: Requires careful management of holiday lists; can be less intuitive for users unfamiliar with function syntax; may need adjustment for international or non-standard workweeks.

Handling Partial Days and Time Differences

Calculating days between two dates in Excel usually focuses on whole days, but sometimes users need to factor in time components as well.

Dates and times in Excel are represented as decimal numbers, where the integer part is the date, and the fractional part represents the time of day. For example, 0.5 corresponds to 12:00 noon.

To calculate the exact time difference between two date-time values (including hours and minutes), simply subtract the earlier datetime from the later one:

=B1 - A1

Format the result as a number or custom time format. To convert this difference into hours, multiply by 24:

=(B1 - A1) * 24

Similarly, to find minutes, multiply by 24*60.

This precision is critical in environments such as healthcare, manufacturing, or customer support where exact time intervals impact billing or performance metrics.

Limitations and Considerations

When dealing with partial days, be mindful of cell formats. Excel may display time differences in unexpected ways if cells are formatted as dates rather than numbers or times.

Also, negative date differences (i.e., if the start date is after the end date) can produce errors or negative values, which may require conditional handling.

Comparing Date Difference Methods: Which One to Use?

Choosing the right method to calculate days between two dates in Excel depends on specific requirements:

  • Simple difference: Use direct subtraction when only calendar days are needed and dates are valid.
  • Precise units: Use DATEDIF for flexible measurement in days, months, or years.
  • Working days: Use NETWORKDAYS or NETWORKDAYS.INTL when excluding weekends and holidays is necessary.
  • Time-sensitive: Use subtraction with date-time values and appropriate formatting for partial days.

Each method has trade-offs between simplicity, flexibility, and accuracy. Advanced users may combine functions, such as using DATEDIF alongside NETWORKDAYS, to obtain nuanced results.

Practical Examples and Use Cases

Consider a project manager tasked with calculating the duration of a task excluding weekends and company holidays. Using NETWORKDAYS with an up-to-date holiday list ensures accurate scheduling and resource allocation.

In finance, an analyst might use simple subtraction or DATEDIF to determine days elapsed between transaction dates for interest calculations. However, in payroll processing, NETWORKDAYS.INTL may be preferred to accommodate non-standard workweeks.

Human resources departments often calculate service length in years, months, and days using DATEDIF, providing comprehensive tenure reports for employees.

Tips for Ensuring Accuracy

  • Always verify that date inputs are recognized as valid Excel dates, not text.
  • Maintain a consistent date format across the spreadsheet to avoid calculation errors.
  • Update holiday lists regularly when using NETWORKDAYS functions to reflect current non-working days.
  • Use conditional formatting or error checks to highlight negative or invalid date differences.

By carefully selecting and applying these techniques, Excel users can harness robust date difference calculations tailored to their operational needs.


Calculating the days between two dates in Excel is more than a basic arithmetic exercise—it is a multifaceted process that can adapt to complex business rules and timekeeping standards. Whether through simple subtraction, the versatile DATEDIF function, or the customized NETWORKDAYS methods, Excel provides powerful tools to analyze temporal data with precision and ease. Mastery of these functions empowers users to manage schedules, analyze trends, and make informed decisions driven by accurate date calculations.

💡 Frequently Asked Questions

How can I calculate the number of days between two dates in Excel?

You can simply subtract the earlier date from the later date using a formula like =B1 - A1, where A1 and B1 contain the two dates. Excel will return the number of days between them.

What Excel function calculates the exact number of days between two dates excluding weekends?

Use the NETWORKDAYS function: =NETWORKDAYS(start_date, end_date). This function calculates the number of working days between two dates, excluding weekends and optionally holidays.

How do I include holidays when calculating days between two dates in Excel?

Use NETWORKDAYS with a holiday range: =NETWORKDAYS(start_date, end_date, holidays), where 'holidays' is a range containing holiday dates to be excluded from the count.

Can I calculate the difference between two dates in months or years instead of days in Excel?

Yes, use the DATEDIF function. For months: =DATEDIF(start_date, end_date, "M"), for years: =DATEDIF(start_date, end_date, "Y"). For days, use "D".

Why does subtracting dates in Excel sometimes return a date instead of a number?

If the cell is formatted as a date, Excel will display the result as a date. Change the cell format to 'General' or 'Number' to see the difference in days as a number.

Discover More

Explore Related Topics

#calculate days between dates excel
#excel date difference
#number of days between dates excel
#days calculation excel formula
#datedif function excel
#subtract dates excel
#count days between two dates excel
#excel days between dates formula
#difference between dates excel
#excel date subtraction