How To Calculate Days On Excel

Excel Days Calculator

Calculate days between dates, add/subtract days, or find workdays in Excel

Comprehensive Guide: How to Calculate Days in Excel

Excel is one of the most powerful tools for date calculations, offering multiple functions to compute days between dates, add/subtract days, and calculate workdays while excluding weekends and holidays. This guide covers everything from basic to advanced techniques for working with dates in Excel.

1. Understanding Excel Date System

Excel stores dates as sequential numbers called serial numbers. By default:

  • January 1, 1900 = 1 (Windows Excel)
  • January 1, 1904 = 0 (Mac Excel prior to 2011)
  • Each day increments the number by 1

This system allows Excel to perform mathematical operations on dates. For example, subtracting two dates gives you the number of days between them.

2. Basic Date Calculations

2.1 Days Between Two Dates

The simplest way to calculate days between dates is by subtracting them:

=End_Date - Start_Date

Example: =B2-A2 where A2 contains 1/1/2023 and B2 contains 1/15/2023 returns 14.

2.2 Adding Days to a Date

Use the simple addition operator:

=Start_Date + Number_Of_Days

Example: =A2+30 adds 30 days to the date in A2.

2.3 Subtracting Days from a Date

Similarly, use subtraction:

=Start_Date - Number_Of_Days

Example: =A2-7 subtracts 7 days from the date in A2.

3. Advanced Date Functions

3.1 DATEDIF Function (Hidden but Powerful)

The DATEDIF function calculates the difference between two dates in various units:

=DATEDIF(start_date, end_date, unit)
Unit Description Example Result
“D” Days between dates =DATEDIF(“1/1/2023″,”1/15/2023″,”D”) 14
“M” Complete months between dates =DATEDIF(“1/1/2023″,”3/15/2023″,”M”) 2
“Y” Complete years between dates =DATEDIF(“1/1/2020″,”3/15/2023″,”Y”) 3
“YM” Months excluding years =DATEDIF(“1/1/2020″,”3/15/2023″,”YM”) 2
“MD” Days excluding months/years =DATEDIF(“1/1/2023″,”3/15/2023″,”MD”) 14
“YD” Days excluding years =DATEDIF(“1/1/2020″,”3/15/2023″,”YD”) 73

3.2 NETWORKDAYS Function (Business Days Only)

Calculates workdays between two dates, excluding weekends and optionally holidays:

=NETWORKDAYS(start_date, end_date, [holidays])

Example: =NETWORKDAYS("1/1/2023","1/31/2023",A2:A5) where A2:A5 contains holiday dates.

Scenario Formula Result (1/1/2023 to 1/31/2023)
Basic workdays (Sat-Sun weekends) =NETWORKDAYS(“1/1/2023″,”1/31/2023”) 22
With 2 holidays (1/2 and 1/16) =NETWORKDAYS(“1/1/2023″,”1/31/2023”,{“1/2/2023″,”1/16/2023”}) 20
Friday-Saturday weekends =NETWORKDAYS.INTL(“1/1/2023″,”1/31/2023”,7) 24

3.3 WORKDAY Function (Add Workdays)

Adds a specified number of workdays to a start date:

=WORKDAY(start_date, days, [holidays])

Example: =WORKDAY("1/1/2023",10,A2:A5) returns 1/17/2023 (10 workdays later, excluding weekends and holidays in A2:A5).

3.4 YEARFRAC Function (Fraction of Year)

Calculates the fraction of a year between two dates:

=YEARFRAC(start_date, end_date, [basis])

Basis options:

  • 0 or omitted = US (NASD) 30/360
  • 1 = Actual/actual
  • 2 = Actual/360
  • 3 = Actual/365
  • 4 = European 30/360

4. Handling Weekends and Holidays

4.1 Custom Weekend Patterns

The NETWORKDAYS.INTL function allows custom weekend definitions:

=NETWORKDAYS.INTL(start_date, end_date, [weekend], [holidays])
Weekend 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 Sunday only
12 Monday only
13 Tuesday only
14 Wednesday only
15 Thursday only
16 Friday only
17 Saturday only

4.2 Holiday Lists

For accurate workday calculations, maintain a holiday list in your workbook:

  1. Create a named range (e.g., “Holidays”) for your holiday dates
  2. Reference this range in your NETWORKDAYS or WORKDAY functions
  3. Update the list annually for recurring holidays

Example holiday list format:

        Date        Holiday
        1/1/2023    New Year's Day
        1/16/2023   MLK Day
        2/20/2023   Presidents' Day
        

5. Common Date Calculation Scenarios

5.1 Project Timelines

Calculate project durations excluding weekends:

=NETWORKDAYS(Start_Date, End_Date)

For a 30-day project starting 3/1/2023: =NETWORKDAYS("3/1/2023","3/30/2023") returns 22 workdays.

5.2 Delivery Dates

Promise delivery in “5 business days”:

=WORKDAY(Order_Date, 5)

If ordered on Monday 3/6/2023: =WORKDAY("3/6/2023",5) delivers on Monday 3/13/2023.

5.3 Age Calculations

Calculate exact age in years, months, and days:

        =DATEDIF(Birth_Date, TODAY(), "Y") & " years, " &
        DATEDIF(Birth_Date, TODAY(), "YM") & " months, " &
        DATEDIF(Birth_Date, TODAY(), "MD") & " days"
        

5.4 Contract Expiration

Add 90 days to contract start date (including weekends):

=Start_Date + 90

For workdays only: =WORKDAY(Start_Date, 90)

6. Troubleshooting Common Issues

6.1 #VALUE! Errors

Common causes:

  • Non-date values in date cells
  • Text that looks like dates but isn’t recognized
  • Invalid date ranges (end date before start date)

Solution: Use DATEVALUE to convert text to dates or ISNUMBER to validate.

6.2 Incorrect Weekend Calculations

If NETWORKDAYS counts wrong:

  • Verify your weekend parameter (1 for Sat-Sun)
  • Check for hidden characters in date cells
  • Ensure dates are valid (e.g., no 2/30/2023)

6.3 1900 vs 1904 Date Systems

Mac Excel (pre-2011) uses 1904 date system. To check:

  1. Go to Excel Preferences > Calculation
  2. Look for “1904 date system” checkbox
  3. Uncheck to match Windows Excel

7. Advanced Techniques

7.1 Dynamic Date Ranges

Create formulas that adjust to current date:

        =TODAY() - 30  // 30 days ago
        =EOMONTH(TODAY(),0)  // End of current month
        =WORKDAY(TODAY(),30)  // 30 workdays from today
        

7.2 Conditional Date Calculations

Use IF with date functions:

        =IF(NETWORKDAYS(A2,B2)>10,"Long Project","Short Project")
        =IF(WEEKDAY(A2,2)<6,"Weekday","Weekend")
        

7.3 Array Formulas for Multiple Dates

Calculate days between multiple date pairs:

{=B2:B10-A2:A10}

Enter with Ctrl+Shift+Enter in older Excel versions.

8. Excel vs Google Sheets Differences

Feature Excel Google Sheets
Date System Start 1/1/1900 (or 1/1/1904 on Mac) 12/30/1899
DATEDIF Availability Hidden but works Fully documented
NETWORKDAYS.INTL Available Available
Holiday Parameter Range reference Range reference or array
Array Formulas Ctrl+Shift+Enter (legacy) Automatic array handling
TODAY() Updates On open or F9 Continuous (every few minutes)

9. Best Practices for Date Calculations

  1. Always use cell references instead of hardcoded dates for flexibility
  2. Validate dates with ISNUMBER or Data Validation
  3. Document your holiday lists with clear naming conventions
  4. Use named ranges for frequently used date ranges
  5. Consider time zones when working with international dates
  6. Format consistently using mm/dd/yyyy or dd-mm-yyyy throughout your workbook
  7. Test edge cases like leap years (2/29) and month-end dates

10. Learning Resources

For official documentation and advanced techniques, consult these authoritative sources:

11. Frequently Asked Questions

Q: Why does Excel show ###### instead of my date?

A: This indicates the column isn't wide enough to display the date format. Widen the column or change the date format to something shorter (e.g., "mm-dd-yy").

Q: How do I calculate someone's age in Excel?

A: Use: =DATEDIF(Birthdate, TODAY(), "Y") for years, or combine with "YM" and "MD" for full age breakdown.

Q: Can Excel handle dates before 1900?

A: No, Excel's date system starts at 1/1/1900 (or 1/1/1904 on Mac). For earlier dates, you'll need to store them as text or use custom solutions.

Q: Why is NETWORKDAYS giving me a different answer than manual counting?

A: Verify:

  • Your weekend parameter (1 for Sat-Sun)
  • Holiday list is complete and correctly referenced
  • No hidden characters in date cells
  • Dates are valid (e.g., no 2/30)

Q: How do I calculate only weekdays between two dates?

A: Use =NETWORKDAYS(start,end) for Sat-Sun weekends, or =NETWORKDAYS.INTL(start,end,weekend_number) for custom weekends.

Q: What's the fastest way to enter a series of dates?

A:

  1. Enter the first date
  2. Select the cell, hover over the bottom-right corner until you see a +
  3. Drag down to fill the series
  4. Use the Fill Handle options to choose fill type

12. Conclusion

Mastering date calculations in Excel opens up powerful possibilities for project management, financial analysis, and data tracking. By understanding the core functions like DATEDIF, NETWORKDAYS, and WORKDAY, you can handle virtually any date-based scenario that arises in business or personal contexts.

Remember to:

  • Always validate your date inputs
  • Document your holiday lists clearly
  • Test your calculations with known examples
  • Use cell references instead of hardcoded dates
  • Consider time zones for international applications

For the most accurate results, especially in business contexts, always cross-validate your Excel calculations with manual checks or alternative methods when dealing with critical deadlines or financial dates.

Leave a Reply

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