HomeGoogle DocsSpreadsheetElapsed Days and Time Between Two Dates in Google Sheets

Elapsed Days and Time Between Two Dates in Google Sheets

Published on

How to calculate elapsed time in days, hours, minutes, and seconds in Google Sheets. We can find the elapsed days and time between two dates in Google Sheets using the INT function.

As an example, in cell A2 I have the timestamp (date time) in the format 08/01/2019 13:00:00 and in B2 it’s 10/01/2019 16:30:00.

Elapsed time is the time that goes by from the beginning of an event
(08/01/2019 13:00:00) to its end (10/01/2019 16:30:00).

What I want is the elapsed time in the format in days, hours, minutes and seconds like 2d 03:30:00. Which means the elapsed time is 2 days 3 hours and 30 minutes.

See how to create an elapsed time date calculator in Google Sheets using the built-in functions.

How to Calculate the Elapsed Days and Time Between Two Dates

First, I will show you how to calculate the elapsed days and time separately. Then we can learn how to format that as required.

Assume the above event start time is in cell A2 and end time in cell B2.

The Formula in cell C2 to get days elapsed.

Formula # 1:

=int(B2-A2)

The Formula in cell D2 to get time elapsed.

Formula # 2:

=text(B2-A2-int(B2-A2),"HH:MM:SS")
Find elapsed time using INT function in Google Sheets

How to Format the Elapsed Days and Time Between Two Dates

I am going for a limited formatting and we can’t skip this as now the elapsed day is in one column and time in another column.

See the above screenshot. Actually what I am doing is combining both the formula outputs and separating the date and duration with “d”.

=C2&"d "&D2

You can replace the cell reference C2 and D2 with the formula # 1 and formula # 2 as below.

=int(B2-A2)&"d "&text(B2-A2-int(B2-A2),"HH:MM:SS")

Array Formula that Returns Elapsed Days and Time in Google Sheets

If you have multiple event start and end time, then better to go for an array formula.

Forming an array formula is not that much tough with supporting Google Sheets functions.

No doubt the function INT and the ampersand sign that I have used to combine elapsed days and time support the ArrayFormula function.

When forming an array formula, you must include the option to limit the formula output to non-blank rows. Otherwise, your spreadsheet may become very resource hungry.

Using LEN in IF Statment is that solution.

=ArrayFormula(IFERROR(if(Len(A2:A),(int(B2:B-A2:A)&"d "&text(B2:B-A2:A-int(B2:B-A2:A),"HH:MM:SS")),)))

The above formula returns the elapsed days and time between the dates in the range A2:B as follows.

Array Formula - Elapsed Days and Time Between Two Dates

Related Reading:

  1. How to Compare Time Stamp with Normal Date in Google Sheets.
  2. How to Deduct Lunch Break Time From Total Hours in Google Sheets.
  3. Payroll Hours Time Calculation in Google Sheets Using Time Functions.
  4. Google Sheets: The Best Overtime Calculation Formula.
  5. How to Convert Military Time in Google Sheets.
  6. Move Time In and Time Out to the Same Row in Google Sheets.
Prashanth KV
Prashanth KV
Your Trusted Google Sheets and Excel Guide Prashanth KV brings a wealth of experience in Google Sheets and Excel, cultivated through years of work with multinational corporations in Mumbai and Dubai. As a recognized Google Product Expert in Docs Editors, Prashanth shares his expertise through insightful blogging since 2012. Explore his blog for practical tips and guidance on maximizing your spreadsheet skills.

Get Top N Values Using Excel’s FILTER Function

When using the FILTER function in Excel to extract the top N values, it's...

XLOOKUP in Excel: Working with Visible Rows in a Table

In Excel, the XLOOKUP function isn't inherently designed to exclusively work with visible rows;...

SUMPRODUCT Differences: Excel vs. Google Sheets

The core purpose of the SUMPRODUCT function remains consistent across both Excel and Google...

Sum Values by Month and Category in Excel

With the help of EOMONTH, UNIQUE, and SUMIFS functions in Excel, you can efficiently...

More like this

Interactive Random Task Assigner in Google Sheets

You have multiple tasks and multiple people. Here's a fun way to randomly assign...

Google Sheets Bar and Column Chart with Target Coloring

To color each data point in the column or bar chart according to the...

Analyzing Column A Between Non-Adjacent Values in Column B: Google Sheets

This tutorial addresses a common scenario encountered in Google Sheets: how to sum, average,...

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.