How To Calculate Days Between Dates On Excel

Excel Days Between Dates Calculator

Calculate the exact number of days between two dates using Excel’s date functions

Calculation Results

Start Date:
End Date:
Calculation Method:
Total Days:
Excel Formula:

Complete Guide: How to Calculate Days Between Dates in Excel

Calculating the number of days between two dates is one of the most common tasks in Excel, whether you’re tracking project timelines, analyzing financial data, or managing employee schedules. This comprehensive guide will walk you through all the methods available in Excel to calculate date differences, including their specific use cases and limitations.

Basic Methods

  • Simple subtraction (End Date – Start Date)
  • DAYS function
  • DATEDIF function

Advanced Methods

  • DAYS360 for financial calculations
  • NETWORKDAYS for business days
  • NETWORKDAYS.INTL for custom weekends

Special Cases

  • Handling leap years
  • Excluding holidays
  • Partial day calculations

Method 1: Simple Subtraction (Most Common)

The simplest way to calculate days between dates is to subtract the start date from the end date. Excel stores dates as sequential numbers (with January 1, 1900 as day 1), so this operation returns the exact number of days between two dates.

Formula: =End_Date – Start_Date

Example: If cell A2 contains 1/15/2023 and cell B2 contains 2/20/2023, the formula =B2-A2 returns 36, which is the number of days between these dates.

Date Format Formula Result Notes
1/15/2023 to 2/20/2023 =B2-A2 36 Basic subtraction works for any date format
6/1/2023 to 6/30/2023 =B3-A3 29 Includes both start and end dates in count
12/31/2022 to 1/1/2023 =B4-A4 1 Handles year transitions automatically

Method 2: Using the DAYS Function (Excel 2013+)

Introduced in Excel 2013, the DAYS function provides a more readable alternative to simple subtraction while producing identical results. This function is particularly useful when you want to make your formulas more understandable to others.

Formula: =DAYS(End_Date, Start_Date)

Example: =DAYS(“2/20/2023”, “1/15/2023”) returns 36, same as the subtraction method.

Advantages:

  • More readable than simple subtraction
  • Works identically across all Excel versions 2013 and later
  • Can handle date strings directly without cell references

Method 3: Using DATEDIF for Flexible Calculations

The DATEDIF function (short for “Date Difference”) is a legacy function that offers more flexibility than simple subtraction. It can calculate differences in days, months, or years, and works in all versions of Excel.

Formula for days: =DATEDIF(Start_Date, End_Date, “d”)

Other units:

  • “m” – Complete months between dates
  • “y” – Complete years between dates
  • “ym” – Months between dates after complete years
  • “yd” – Days between dates after complete years
  • “md” – Days between dates after complete months and years
Unit Formula Example Result (for 1/15/2023 to 2/20/2023) Description
“d” =DATEDIF(A2,B2,”d”) 36 Total days between dates
“m” =DATEDIF(A2,B2,”m”) 1 Complete months between dates
“y” =DATEDIF(A2,B2,”y”) 0 Complete years between dates
“ym” =DATEDIF(A2,B2,”ym”) 1 Months remaining after complete years
“md” =DATEDIF(A2,B2,”md”) 5 Days remaining after complete months

Method 4: DAYS360 for Financial Calculations

The DAYS360 function calculates the number of days between two dates based on a 360-day year (twelve 30-day months), which is commonly used in financial calculations to simplify interest computations.

Formula: =DAYS360(Start_Date, End_Date, [Method])

Method parameter (optional):

  • FALSE or omitted – US method (NASD): If start date is the 31st, it becomes the 30th. If end date is the 31st and start date is before the 30th, end date becomes the 1st of next month.
  • TRUE – European method: Both start and end dates that fall on the 31st become the 30th.

Example: For dates 1/31/2023 to 2/28/2023:

  • =DAYS360(“1/31/2023″,”2/28/2023”) returns 28 (US method)
  • =DAYS360(“1/31/2023″,”2/28/2023”,TRUE) returns 28 (European method)

For dates 1/30/2023 to 2/31/2023 (note: 2/31 doesn’t exist):

  • =DAYS360(“1/30/2023″,”2/28/2023”) returns 28 (US method treats 2/28 as 2/28)
  • =DAYS360(“1/30/2023″,”3/2/2023”) returns 32 (US method treats 2/31 as 3/2)

Method 5: NETWORKDAYS for Business Days

When you need to calculate working days (excluding weekends and optionally holidays), use the NETWORKDAYS function. This is essential for project management, delivery estimates, and other business calculations.

Basic Formula: =NETWORKDAYS(Start_Date, End_Date)

With Holidays: =NETWORKDAYS(Start_Date, End_Date, Holidays_Range)

Example: For dates 1/1/2023 (Sunday) to 1/10/2023 (Tuesday):

  • =NETWORKDAYS(“1/1/2023″,”1/10/2023”) returns 6 (excludes 1/1, 1/7, 1/8)

With holidays in cells D2:D3 (1/2/2023 and 1/16/2023):

  • =NETWORKDAYS(“1/1/2023″,”1/10/2023”,D2:D3) returns 5 (also excludes 1/2)

Method 6: NETWORKDAYS.INTL for Custom Weekends

For organizations with non-standard weekends (e.g., Friday-Saturday in some Middle Eastern countries), use NETWORKDAYS.INTL which allows you to specify which days should be considered weekends.

Formula: =NETWORKDAYS.INTL(Start_Date, End_Date, [Weekend], [Holidays])

Weekend parameter options:

  • 1 or omitted – Saturday, Sunday (default)
  • 2 – Sunday, Monday
  • 3 – Monday, Tuesday
  • 4 – Tuesday, Wednesday
  • 5 – Wednesday, Thursday
  • 6 – Thursday, Friday
  • 7 – Friday, Saturday
  • 11 – Sunday only
  • 12 – Monday only
  • 13 – Tuesday only
  • 14 – Wednesday only
  • 15 – Thursday only
  • 16 – Friday only
  • 17 – Saturday only

Example: For Friday-Saturday weekend (common in some countries):

  • =NETWORKDAYS.INTL(“1/1/2023″,”1/10/2023”,7) returns 7 (excludes 1/6,1/7)

Handling Common Date Calculation Challenges

1. Dealing with Leap Years

Excel automatically accounts for leap years in all date calculations. February will correctly show 28 or 29 days depending on the year. For example:

  • =DAYS(“2/28/2023″,”3/1/2023”) returns 1 (2023 not a leap year)
  • =DAYS(“2/28/2024″,”3/1/2024”) returns 2 (2024 is a leap year)

2. Excluding Specific Holidays

When using NETWORKDAYS or NETWORKDAYS.INTL, you can exclude holidays by:

  1. Creating a range with holiday dates
  2. Referencing that range in the function’s third parameter

Example: With holidays in cells F2:F5:

  • =NETWORKDAYS(A2,B2,F2:F5)

3. Calculating Partial Days

For calculations that need to account for time components (not just dates), you can:

  1. Use datetime values instead of just dates
  2. Multiply the result by 24 to get hours, by 1440 for minutes, or by 86400 for seconds

Example: = (B2-A2)*24 returns hours between two datetime values

Practical Applications of Date Calculations

1. Project Management

Calculate:

  • Project duration in working days
  • Milestone deadlines
  • Resource allocation timelines

2. Human Resources

Track:

  • Employee tenure
  • Vacation accrual periods
  • Probation periods

3. Finance and Accounting

Calculate:

  • Interest accrual periods
  • Payment terms
  • Depreciation schedules

4. Inventory Management

Monitor:

  • Product shelf life
  • Stock rotation schedules
  • Delivery lead times

Best Practices for Date Calculations in Excel

  1. Always use date functions rather than text manipulation to ensure accuracy with date arithmetic.
  2. Format cells as dates (Ctrl+1 > Number > Date) to ensure Excel recognizes them as dates.
  3. Use named ranges for important dates to make formulas more readable.
  4. Validate date inputs using Data Validation to prevent errors.
  5. Document your formulas with comments, especially for complex date calculations.
  6. Test edge cases like leap years, month-end dates, and weekend calculations.
  7. Consider time zones if working with international dates.
  8. Use consistent date formats throughout your workbook.

Common Errors and How to Fix Them

Error Likely Cause Solution
#VALUE! Non-date value in date calculation Ensure both arguments are valid dates or date serial numbers
#NUM! Invalid date (e.g., 2/30/2023) Check date validity and cell formatting
###### Column too narrow to display date Widen column or change date format
Incorrect day count Dates stored as text rather than date values Use DATEVALUE() to convert text to dates
Negative number End date before start date Verify date order or use ABS() function

Advanced Techniques

1. Creating a Date Difference Calculator

Build an interactive calculator with:

  • Dropdown for calculation method
  • Conditional formatting to highlight weekends/holidays
  • Data validation for date inputs

2. Dynamic Date Ranges

Use functions like:

  • TODAY() – Current date
  • EOMONTH() – End of month
  • WORKDAY() – Future/past working day

3. Date Difference Visualization

Create charts to visualize:

  • Project timelines
  • Age distributions
  • Time-to-completion metrics

Excel vs. Other Tools for Date Calculations

Feature Excel Google Sheets Python (pandas) JavaScript
Basic date subtraction Yes (A1-B1) Yes (A1-B1) Yes (df[‘end’]-df[‘start’]) Yes (date2-date1)
Business days calculation NETWORKDAYS() NETWORKDAYS() bdate_range() Custom function needed
360-day year calculation DAYS360() DAYS360() Custom calculation Custom function needed
Leap year handling Automatic Automatic Automatic Automatic
Custom weekend definition NETWORKDAYS.INTL() NETWORKDAYS.INTL() Custom business day freq Custom function needed
Holiday exclusion Yes Yes Yes Yes
Time component handling Yes (datetime values) Yes (datetime values) Yes (Timestamp) Yes (Date object)

Learning Resources

To deepen your understanding of Excel date functions, explore these authoritative resources:

Frequently Asked Questions

1. Why does Excel show ###### instead of my date?

This typically means the column isn’t wide enough to display the entire date. Either widen the column or change the date format to something shorter (like “mm/dd/yyyy” instead of “Monday, January 01, 2023”).

2. How do I calculate someone’s age in Excel?

Use DATEDIF: =DATEDIF(Birthdate, TODAY(), “y”) for years, and =DATEDIF(Birthdate, TODAY(), “ym”) for months since last birthday.

3. Can I calculate the number of weeks between dates?

Yes, divide the day difference by 7: =(End_Date-Start_Date)/7. For whole weeks, use =FLOOR((End_Date-Start_Date)/7,1).

4. How do I exclude specific weekdays (like Fridays) from my calculation?

Use NETWORKDAYS.INTL with a custom weekend parameter that includes Friday, or create a helper column that identifies Fridays and subtract them from your total.

5. Why is DAYS360 giving me a different result than simple subtraction?

DAYS360 uses a 30-day month approximation for financial calculations. For actual calendar days, use simple subtraction or the DAYS function instead.

6. How can I calculate the number of months between dates?

Use DATEDIF with “m”: =DATEDIF(Start_Date, End_Date, “m”). For decimal months (accounting for partial months), use: =(YEAR(End_Date)-YEAR(Start_Date))*12+MONTH(End_Date)-MONTH(Start_Date)+(DAY(End_Date)-DAY(Start_Date))/30.

7. Is there a way to calculate only weekdays between dates?

Yes, use NETWORKDAYS: =NETWORKDAYS(Start_Date, End_Date). This automatically excludes Saturdays and Sundays.

8. How do I handle dates before 1900 in Excel?

Excel’s date system starts at 1/1/1900. For earlier dates, you’ll need to store them as text or use a custom solution. Windows Excel incorrectly thinks 1900 was a leap year (it wasn’t), while Mac Excel uses the correct 1/1/1904 starting date.

9. Can I calculate the number of hours or minutes between dates?

Yes, multiply the date difference by 24 for hours or by 1440 for minutes. For example: =(B2-A2)*24 for hours, =(B2-A2)*1440 for minutes.

10. How do I account for different time zones in my date calculations?

Excel doesn’t natively handle time zones. You’ll need to either:

  • Convert all dates to a single time zone before calculating
  • Add/subtract the time difference manually (e.g., +5/24 for 5-hour difference)
  • Use UTC timestamps if working with international data

Leave a Reply

Your email address will not be published. Required fields are marked *