Elapsed Days and Time Between Two Dates in Google Sheets

Published on

When you have a start date and time along with an end date and time, you may need to calculate the number of elapsed days and time between the two timestamps.

This is useful for tracking durations, similar to a countdown timer, except instead of using the current time as a reference, you are working with predefined timestamps.

In this tutorial, you’ll learn how to calculate elapsed days, hours, minutes, and seconds between two timestamps in Google Sheets using built-in functions.

Generic Formula to Calculate Elapsed Days and Time

=INT(end-start)&"d "&TEXT(end-start-INT(end-start), "HH:MM:SS")
  • start – The start date and time.
  • end – The end date and time.

Example of Calculating Elapsed Days and Time in Google Sheets

To determine the elapsed time between two timestamps, we can use the INT function and TEXT function.

Example Scenario

  • Start Time (A2): 08/01/2019 13:00:00
  • End Time (B2): 10/01/2019 16:30:00

The elapsed time between these two timestamps is 2 days, 3 hours, and 30 minutes, formatted as:

2d 03:30:00

You can use the following formula in C2 to calculate it:

=INT(B2-A2)&"d "&TEXT(B2-A2-INT(B2-A2), "HH:MM:SS")

Let’s go through the steps to compute this.

Step 1: Calculate Elapsed Days

To get the number of full days elapsed, use this formula in C2:

=INT(B2-A2)

This extracts the integer part of the difference, which represents the number of whole days.

Step 2: Calculate Elapsed Time (Hours, Minutes, Seconds)

To calculate the remaining time beyond whole days, use this formula in D2:

=TEXT(B2-A2-INT(B2-A2),"HH:MM:SS")

This extracts only the time portion of the elapsed duration.

Calculate elapsed time using the INT function in Google Sheets

Step 3: Combine Days and Time

To format the elapsed duration as Xd HH:MM:SS, combine the results of the above formulas:

=C2&"d "&D2

Or, use a single formula for a more compact approach:

=INT(B2-A2)&"d "&TEXT(B2-A2-INT(B2-A2), "HH:MM:SS")

This formula dynamically calculates both days and time in one step.

Step 4: Apply an Array Formula for Multiple Rows

If you have multiple rows of start and end times, an ArrayFormula applies the calculation across the entire column:

=ArrayFormula(IF(LEN(A2:A), INT(B2:B-A2:A)& "d "&TEXT(B2:B-A2:A-INT(B2:B-A2:A), "HH:MM:SS"), ""))

This formula ensures that the calculation only applies to non-blank rows, improving efficiency.

Final Output

For multiple timestamps, the output will look like this:

Array formula to calculate elapsed days and time between two dates in Google Sheets

Related Reading

Prashanth KV
Prashanth KV
Your Trusted Google Sheets and Excel Expert Prashanth KV is a Diamond Product Expert in Google Sheets, officially recognized by Google for his contributions to the Docs Editors Help Community and featured in the Google Product Experts Directory. Explore his blog to learn advanced formulas, automation tips, and problem-solving techniques to elevate your spreadsheet skills.

Top Discussions

More like this

Free Monthly Expense Tracker Template in Google Sheets (Dashboard Included)

Watch the quick walkthrough below to see how to use this Free Monthly Expense...

The Complete Guide to XLOOKUP in Google Sheets (15+ Practical Examples)

The XLOOKUP function largely replaces traditional lookup functions such as LOOKUP, VLOOKUP, and HLOOKUP...

How to Sort and Filter Pivot Tables in Google Sheets (Complete Guide)

Sorting and filtering are two of the most important techniques for analyzing data in...

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.