Pinterest Pixel

How to Calculate Time in Between Two Dates in Excel Fast

John Michaloudis
When working with dates in Excel, I often need to calculate the time difference between two dates for tasks like tracking project deadlines, measuring employee tenure, calculating work hours, or scheduling events.
Excel provides multiple ways to calculate time in between two dates, from simple subtraction to advanced functions that exclude weekends and holidays.

When working with dates in Excel, I often need to calculate the time difference between two dates for tasks like tracking project deadlines, measuring employee tenure, calculating work hours, or scheduling events. Excel provides multiple ways to calculate time in between two dates, from simple subtraction to advanced functions that exclude weekends and holidays.

Key Takeaways:

  • Excel stores dates as serial numbers, so proper formatting prevents calculation errors.
  • Subtracting dates gives the number of days between them while adding 1 includes both start and end dates.
  • The DATEDIF function calculates precise differences in years, months, and days, even though it’s hidden in Excel.
  • NETWORKDAYS and NETWORKDAYS.INTL help exclude weekends and holidays when counting workdays.
  • The WORKDAY function calculates future dates by adding workdays while skipping weekends and holidays.

 

Formatting Dates in Excel

Before performing any date-related calculations in Excel, I always ensure that my dates are correctly formatted. Excel stores dates as serial numbers, meaning that each date corresponds to a unique numerical value starting from January 1, 1900 (serial number 1). For example, March 22, 2024, is actually stored as 45353 in Excel.

This system allows for easy date calculations, but if a date is not properly formatted, Excel might misinterpret it as text, leading to errors in formulas. To avoid issues, I make sure to format dates in a consistent, recognizable format such as MM/DD/YYYY (03/22/2024) or DD-MMM-YYYY (22-Mar-2024). Follow these steps to correctly format dates:

STEP 1: Select the cells containing dates.

Time in Between Two Dates

STEP 2: Press Ctrl + 1 to open the Format Cells dialog box.

Time in Between Two Dates

STEP 3: Click the Number tab and select Date.

Time in Between Two Dates

STEP 4: Choose a format like MM/DD/YYYY or DD-MMM-YYYY.

Time in Between Two Dates

STEP 5: Click OK to apply the format and check the results.

Time in Between Two Dates

This ensures that Excel treats the values as dates, making calculations more accurate.

 

Calculating Elapsed Time in Days

The simplest way to find the difference between two dates is to subtract them. Since Excel stores dates as numbers, this returns the number of elapsed days. If I want to find the number of days between March 1, 2024, and March 15, 2024, I follow these steps:

STEP 1: Enter the start date in cell A2 (03/01/2024).

Time in Between Two Dates

STEP 2: Enter the end date in cell B2 (03/15/2024).

Time in Between Two Dates

STEP 3: In cell C2, enter the formula:

=B2 – A2

Time in Between Two Dates

STEP 4: Press Enter to get the result.

Time in Between Two Dates

The output is 14, meaning 14 days have passed. To include both the start and end dates, I modify the formula:

=B2 – A2 + 1

Time in Between Two Dates

Using DATEDIF for Precise Years, Months, and Days

When I need to calculate the difference between two dates with precision, I rely on the DATEDIF function. Unlike simple subtraction, which only returns the number of elapsed days, DATEDIF allows me to break down the difference into years, months, and days separately. This is particularly useful for age calculations, employee tenure tracking, and contract duration analysis.

Excel doesn’t list DATEDIF as a built-in function in the formula suggestions, but it still works when entered manually. The function uses the following syntax:

=DATEDIF(start_date, end_date, unit)

  • start_date – The beginning date of the calculation
  • end_date – The final date for the calculation
  • unit – Specifies whether I want the difference in years (“Y”), months (“M”), or days (“D”)

Let’s say I need to calculate the exact difference between Calculating Age or Work Tenure, I used these steps:

STEP 1: Enter the hire date in A2 (01/01/2015).

Time in Between Two Dates

STEP 2: Enter today’s date in B2 (03/22/2024).

Time in Between Two Dates

STEP 3: Use these formulas:

  • Years: =DATEDIF(B2, C2, “Y”)

Time in Between Two Dates

  • Months (excluding full years): =DATEDIF(B2, C2 “YM”)

Time in Between Two Dates

  • Days (excluding full years and months): =DATEDIF(B2, C2, “MD”)

Time in Between Two Dates

For a hire date of January 1, 2015, and today’s date March 22, 2024, the formulas return:

  • Years: 9
  • Months: 2
  • Days: 21

STEP 4: Drag these formulas for all the rows.

Time in Between Two Dates

This method is perfect for calculating employee tenure, age, and contract durations. This is especially helpful in reports where I need to present data in a human-friendly format, such as employee tenure records, loan repayment schedules, or historical event tracking.

 

Handling Work Hours and Excluding Weekends & Holidays

In business, I often need to count only the working days between two dates while excluding weekends and holidays. This is especially useful for calculating employee work periods, setting project deadlines, or determining invoice due dates. If I include weekends and holidays in my calculations, my deadlines could be incorrect, leading to scheduling conflicts or payroll miscalculations.

Excel provides three useful functions to handle this:

  1. NETWORKDAYS – Counts the number of workdays between two dates, automatically excluding weekends (Saturday & Sunday by default) and any specified holidays.
  2. NETWORKDAYS.INTL – Works like NETWORKDAYS but allows me to define which days are weekends (e.g., Friday-Saturday or Sunday-Monday).
  3. WORKDAY – Calculates the end date after adding a specific number of workdays, excluding weekends and holidays.

Using NETWORKDAYS to Count Workdays

The NETWORKDAYS function helps me determine how many working days fall between two dates while automatically skipping weekends and holidays. Syntax: =NETWORKDAYS(start_date, end_date, holidays)

If I have a project that starts on March 1, 2025 (cell B2) and ends on March 15, 2025 (cell C2), I can calculate the total workdays as shown below –

Time in Between Two Dates

Excel automatically excludes Saturdays and Sundays from the count.

Excluding Holidays in the Calculation

If my company observes certain holidays, I can provide a list of holiday dates (e.g., in D2:D5) and modify the formula:

=NETWORKDAYS(B2, C2, D2)

For example, if March 8, 2025, is a public holiday, the formula would return 10 workdays instead of 11.

Time in Between Two Dates

Using NETWORKDAYS.INTL for Custom Weekends

Some businesses have different weekend policies. The NETWORKDAYS.INTL function allows me to customize weekends beyond the standard Saturday-Sunday setup. Syntax:

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

If my company observes weekends on Fridays and Saturdays, I use: =NETWORKDAYS.INTL(B2, C2, 7)

Time in Between Two Dates

Here, the 7 tells Excel that Friday and Saturday are non-working days.

Weekend Codes:

  • 1 – Saturday & Sunday (default)
  • 2 – Sunday & Monday
  • 3 – Monday & Tuesday
  • 7 – Friday & Saturday

Using WORKDAY to Calculate a Due Date

The WORKDAY function helps me find the end date after adding a certain number of working days (excluding weekends and holidays). This is useful when setting deadlines for project tasks or invoice due dates.

Syntax: =WORKDAY(start_date, days, holidays)

If an employee starts work on March 1, 2024 (B2) and needs 10 full workdays to complete a task, I can determine the completion date: =WORKDAY(B2, 10, C2)

If March 8 is a holiday, Excel will exclude weekends and holidays, giving the correct due date.

Time in Between Two Dates

 

Practical Business Example: Employee Payroll Calculation

Let’s say I’m managing payroll for an employee who worked in March 2024. I need to calculate the number of actual working days they were present, excluding weekends and public holidays.

  • Start Date: March 1, 2024 (B2)
  • End Date: March 31, 2024 (C2)
  • Company Holidays: March 8 & March 25 (D2:D3)

Formula: =NETWORKDAYS(B2,C2,D2:D3)

Time in Between Two Dates

This returns the exact number of working days in March, helping me accurately calculate salaries based on actual workdays.

Similarly, I can use the WORKDAY function to predict salary processing dates by adding a fixed number of workdays and avoiding weekends or bank holidays.

By leveraging these Excel functions, I can efficiently manage deadlines, calculate work periods, and ensure accurate payroll processing in a professional setting.

FAQs

How can I calculate the time between two dates in Excel?

To calculate the time between two dates in Excel, simply subtract the earlier date from the later date using a formula like =B1-A1, where B1 is the end date and A1 is the start date. Ensure both cells are formatted as Date to get the number of days. You can further format or modify this for hours by multiplying by 24 or using additional functions for precision.

What formula should I use to find elapsed hours and minutes?

To find elapsed hours and minutes in Excel, use the formula =TEXT(B1-A1, "h:mm"), where B1 is the end time and A1 is the start time. Ensure both cells have a Date/Time format, and this formula will display the difference in hours and minutes, accounting for any time that spans across days.

Can Excel account for holidays in time calculations?

Yes, Excel can account for holidays in time calculations using the NETWORKDAYS or NETWORKDAYS.INTL functions. By adding a range of holiday dates as an optional argument, these functions exclude specified holidays from the total count of working days between two dates, alongside weekends.

Is datedif still in Excel?

Yes, the DATEDIF function is still available in Excel. It’s a hidden feature and not listed in the formula menu, but you can use it to calculate the difference between dates in units like years, months, or days by entering the formula manually.

If you like this Excel tip, please share it


Founder & Chief Inspirational Officer

at

John Michaloudis is a former accountant and finance analyst at General Electric, a Microsoft MVP since 2020, an Amazon #1 bestselling author of 4 Microsoft Excel books and teacher of Microsoft Excel & Office over at his flagship MyExcelOnline Academy Online Course.

See also  How to Add Time Efficiently in Excel

Star 30 Days - Full Access Star

One Dollar Trial

$1 Trial for 30 days!

Access for $1

Cancel Anytime

One Dollar Trial
  • Get FULL ACCESS to all our Excel & Office courses, bonuses, and support for just USD $1 today! Enjoy 30 days of learning and expert help.
  • You can CANCEL ANYTIME — no strings attached! Even if it’s on day 29, you won’t be charged again.
  • You'll get to keep all our downloadable Excel E-Books, Workbooks, Templates, and Cheat Sheets - yours to enjoy FOREVER!
  • Practice Workbooks
  • Certificates of Completion
  • 5 Amazing Bonuses
Satisfaction Guaranteed
Accepted paymend methods
Secure checkout

Get Video Training

Advance your Microsoft Excel & Office Skills with the MyExcelOnline Academy!

Dramatically Reduce Repetition, Stress, and Overtime!
Exponentially Increase Your Chances of a Promotion, Pay Raise or New Job!

Learn in as little as 5 minutes a day or on your schedule.

Learn More!

Share to...