How to Get Days Between Dates in Excel

Learn multiple Excel methods to get days between dates with step-by-step examples and practical applications.

excelformulaspreadsheettutorial
10 min read • Last updated: 7/2/2025

How to Get Days Between Dates in Excel

Why This Task Matters in Excel

Every industry that tracks schedules, deadlines, or durations eventually has to answer one deceptively simple question: “How many days lie between these two dates?” Project managers calculate task lead times, HR departments determine employees’ length of service, finance teams gauge the number of days interest accrues, and logistics professionals compare delivery dates to promised service levels. The ability to calculate date differences quickly and accurately is foundational to reliable reporting and decision-making.

In a business context, the consequences of miscounting days can be severe. A late purchase-order shipment might trigger costly penalties, or an inaccurate benefits eligibility date could lead to compliance issues. These real-world scenarios hinge on correctly measuring date intervals. Excel excels at date arithmetic because its underlying date system stores each calendar day as a sequential serial number. This design lets you treat dates just like numbers, enabling straightforward subtraction, but it also empowers sophisticated calculations such as excluding weekends or accounting for regional holiday calendars.

Several Excel functions can return the days between dates, each optimized for different scenarios. The subtraction operator is lightning-fast for basic counts, while DAYS offers clarity in formulas. DATEDIF, although undocumented in Excel’s ribbon, provides versatile return units (days, months, years, or combined). NETWORKDAYS and NETWORKDAYS.INTL handle business-day calculations, honoring standard or custom weekend definitions and optional holiday lists. Choosing the right approach links directly to downstream tasks such as conditional formatting, pivot-table grouping, or Power Query data transformations.

Not mastering this task can compromise workflows elsewhere: dashboards may reflect misleading project slippage, KPIs become skewed, and automated alerts trigger at the wrong time. Conversely, proficiency with date-difference techniques allows analysts to chain calculations (for example, dividing day counts by 365.25 for annualized rates) and integrate seamlessly with other Excel competencies like dynamic array filtering or VBA automation.

Best Excel Approach

For straightforward “calendar day” differences—where every day on the calendar counts—the simplest, fastest, and most transparent approach is direct subtraction. Because Excel stores dates as serial numbers, subtracting one date from another yields the number of days between them.

=B2 - A2

Cell [A2] contains the start date and [B2] the end date. No additional functions are required, and the formula recalculates instantly, even on massive datasets. When you require clarity in shared workbooks, wrap the calculation in the DAYS function to show intent explicitly:

=DAYS(B2, A2)

Use this method when:

  • Both dates are valid Excel dates.
  • You need inclusive or exclusive calculations easily (e.g., add or subtract 1 afterward).
  • You do not need to treat weekends or holidays differently.

Prerequisites: Ensure the cells are properly formatted as dates or stored as date-serials. If they arrive as text, convert them first with DATEVALUE or Power Query transformations. The logic is purely numeric: Excel counts whole days between two integers. The calculation is deterministic and locale-independent, which makes it ideal for cross-team spreadsheets.

If your goal is to exclude weekends or custom days off, see NETWORKDAYS in the Alternative Methods section.

Parameters and Inputs

Date difference formulas typically need only two inputs—Start_Date and End_Date—both expected as numeric serials or date-formatted cells.

Required inputs

  • Start_Date: The earlier date. For negative durations, End_Date may be earlier, but plan for absolute values or error handling.
  • End_Date: The later date.

Optional inputs (specific to alternative functions)

  • Weekend_Type: NETWORKDAYS.INTL lets you specify which days act as weekends via a 7-character mask like \"0000011\".
  • Holidays: NETWORKDAYS and NETWORKDAYS.INTL accept a range [G2:G20] containing company holidays to exclude.

Data preparation

  • Ensure no blank cells—blank dates subtract as zero and can skew averages.
  • Verify imported CSVs: text dates won’t calculate. DATEVALUE or --A2 coerces text to serials.
  • Confirm regional date formats (day-month vs month-day) to avoid inversion.

Edge cases

  • Leap years: Excel counts February 29 automatically.
  • Times included: Subtraction yields fractions (e.g., 2.5 days). Wrap with INT to truncate or use ROUND if needed.
  • Negative results: Consider ABS if you always want positive day counts.

Step-by-Step Examples

Example 1: Basic Scenario

Imagine a to-do list where tasks have simple start and end dates. In [A2:A6] enter Start_Date values: 1-Mar-2024, 4-Mar-2024, 7-Mar-2024, 10-Mar-2024, 15-Mar-2024. In [B2:B6] enter End_Date: 5-Mar-2024, 5-Mar-2024, 9-Mar-2024, 15-Mar-2024, 20-Mar-2024.

Step-by-step:

  1. Select [C2], label the column Days.
  2. Enter =B2 - A2 and press Enter.
  3. Copy the formula down to [C6].

Results: [C2] shows 4, meaning four calendar days from 1-Mar to 5-Mar, exclusive of the start date.

Why it works: Excel serial numbers treat 1-Mar-2024 as 45156 and 5-Mar-2024 as 45160. The numeric difference is 4.

Variations:

  • Inclusive count: Add 1 (=B2 - A2 + 1).
  • Show negative values in red using conditional formatting to flag tasks completed before they began.

Troubleshooting:

  • If you see ##### symbols, widen the column or format as General.
  • A result that looks like a date (e.g., 5-Jan-1900) means the result cell is formatted as Date—change to Number with zero decimals.

Example 2: Real-World Application

A logistics coordinator tracks container dwell time at a port. Arrival_Date is in [D2:D500], Departure_Date in [E2:E500]. The company is billed storage fees after five days.

Steps:

  1. In [F2] enter =E2 - D2. Label the column \"Days In Port.\"
  2. In [G2] create a flag for chargeable days:
=IF(F2 > 5, F2 - 5, 0)
  1. Copy downward.
  2. Sum [G2:G500] to estimate total billable days for the month.

Integration: Feed the results to Power Pivot measures for financial forecasting.

Business impact: Accurate day counts prevent over- or under-payment of port fees, directly protecting margins.

Performance considerations: Subtraction formulas are virtually instant, but when dealing with hundreds of thousands of rows, convert volatile functions in other columns to static values to keep the model snappy.

Example 3: Advanced Technique

A consulting firm offers service-level agreements that exclude weekends and company holidays. Start_Date in [H2], End_Date in [I2], holiday list in [L2:L20].

  1. In [J2] compute business days with NETWORKDAYS:
=NETWORKDAYS(H2, I2, $L$2:$L$20)
  1. If the agreement uses a non-standard weekend (Friday-Saturday), upgrade to NETWORKDAYS.INTL:
=NETWORKDAYS.INTL(H2, I2, "0000011", $L$2:$L$20)

Explanation: The 7-digit mask reads Monday through Sunday; 1 means weekend, 0 means workday, so \"0000011\" treats Friday and Saturday as non-working.

  1. Incorporate error handling for reversed dates:
=IF(H2 > I2, "Check Dates", NETWORKDAYS.INTL(H2, I2, "0000011", $L$2:$L$20))

Optimization: Create dynamic named ranges for holidays so newly added dates automatically extend the list. Using structured references in Excel Tables also ensures the formula adapts without manual edits.

Tips and Best Practices

  • Store dates in an Excel Table—formulas automatically fill down, and structured references make reading formulas easier.
  • Use custom number format [>1]0 "days";0 "day" to display singular/plural correctly without extra columns.
  • Convert volatile TODAY() references to static values when distributing large files; a heavy recalculation can slow performance.
  • For dashboards, wrap day counts in MAX(,0) to avoid negative bars in charts.
  • Keep a single, centralized holiday list to ensure all NETWORKDAYS calculations align company-wide.
  • Document your weekend mask codes in a hidden sheet so colleagues immediately know what \"0000011\" means.

Common Mistakes to Avoid

  1. Mixing text dates with true dates: Text cannot be subtracted reliably. Convert with DATEVALUE or pick the correct import settings.
  2. Forgetting time components: If your data includes timestamps, subtracting may yield decimal days. Use INT for whole days or MOD to isolate hours.
  3. Reversed date order: End_Date earlier than Start_Date produces negative results. Wrap with ABS or add validation rules.
  4. Overlooking inclusive counts: Decide whether to add 1 when the same-day start and end should yield 1 rather than 0.
  5. Neglecting leap-year effects when manually calculating—Excel handles them, so avoid hard-coded assumptions in formulas.

Alternative Methods

MethodSyntaxIncludes Weekends?Holiday SupportExcel VersionTypical Use Case
Direct subtraction=End - StartYesManual onlyAllQuick calendar day counts
DAYS function=DAYS(End, Start)YesManual only2013+Clear intent in shared files
DATEDIF=DATEDIF(Start, End, "d")YesManual onlyAllFlexible units (months, years)
NETWORKDAYS=NETWORKDAYS(Start, End, Holidays)NoYes2007+Standard Monday-Friday workdays
NETWORKDAYS.INTL=NETWORKDAYS.INTL(Start, End, Weekend_Type, Holidays)DependsYes2010+Custom weekends (e.g., Gulf region)

Pros and cons

  • Subtraction: Fastest, but raw; cannot exclude weekends without extra logic.
  • DAYS: Same result as subtraction yet self-documenting.
  • DATEDIF: Offers most unit flexibility but lacks in-formula help.
  • NETWORKDAYS: Great for business calendars; assumes Saturday-Sunday weekend.
  • NETWORKDAYS.INTL: Supreme flexibility; slightly more complex argument list.

Switching methods: If you start with subtraction and need to exclude weekends later, nest NETWORKDAYS inside an IF sequence or replace formulas wholesale; structured references simplify the swap.

FAQ

When should I use this approach?

Use direct subtraction or DAYS for pure calendar counts where every day matters, such as calculating age in days or elapsed time irrespective of weekends. Choose NETWORKDAYS variants when only working days or non-standard calendars matter.

Can this work across multiple sheets?

Yes. Reference the start date on Sheet1 and end date on Sheet2, for example:

=Sheet2!B2 - Sheet1!A2

For holiday lists on another sheet, supply the full range reference in NETWORKDAYS.

What are the limitations?

DAYS, subtraction, and DATEDIF cannot inherently exclude weekends or holidays. DATEDIF is also undocumented, meaning no formula tooltip. NETWORKDAYS functions limit holiday lists to contiguous ranges, so scattered holiday cells need consolidation.

How do I handle errors?

Wrap formulas in IFERROR to trap text strings, blank cells, or reversed dates:

=IFERROR(DAYS(B2,A2),"Invalid dates")

Validate inputs with Data Validation rules restricting entries to dates greater than or equal to a minimum threshold.

Does this work in older Excel versions?

Subtraction and DATEDIF work in all modern versions, including Excel 2003. DAYS requires 2013 or later. NETWORKDAYS is available from Excel 2007 onward, while NETWORKDAYS.INTL needs Excel 2010 or later.

What about performance with large datasets?

Subtraction and DAYS are virtually instantaneous even on hundreds of thousands of rows. NETWORKDAYS has modest overhead because each date must be classified as workday or holiday. When handling millions of rows, consider offloading to Power Query for pre-processing or converting volatile formulas to values post-calculation.

Conclusion

Calculating days between dates is one of the most fundamental, yet mission-critical, skills in Excel. From simple timeline checks to sophisticated SLA monitoring, mastering the array of available techniques—subtraction, DAYS, DATEDIF, and the NETWORKDAYS family—enables you to choose the perfect tool for any scenario. These skills integrate seamlessly with other Excel capabilities like conditional formatting, Power Query, and dynamic arrays, elevating your analytical repertoire. Practice with your own datasets, document your assumptions, and you will soon find that confident, accurate date math becomes second nature, empowering smarter and timelier business decisions.

We use tracking cookies to understand how you use the product and help us improve it. Please accept cookies to help us improve.