How to calculate time intervals between two moments in duration of several days

Elle_saf

New Member
Joined
Sep 6, 2010
Messages
4
Hello.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:eek:ffice:eek:ffice" /><o:p></o:p>
I need to calculate the time intervals between two moments in duration of four days. The results in format of [h]:mm then will be used to draw a chart. <o:p></o:p>
<o:p></o:p>
I am using IF statement as =IF(A1>B1,B1+1-A1,B1-A1); however for times after 24h (next day) this statement does not work. :(
<o:p></o:p>
e.g., <o:p></o:p>
<o:p></o:p>
A1: 2010-0-01 11:15:00 00:00:00<o:p></o:p>
A2: 2010-0-01 14:15:00 03:00:00<o:p></o:p>
A3: 2010-0-01 15:47:00 04:32:00<o:p></o:p>
A4: 2010-0-01 18:02:00 06:47:00<o:p></o:p>
A5: 2010-0-02 12:25:00 01:10:00 must be 25:10:00<o:p></o:p>
A6: 2010-0-02 15:48:00 04:33:00 must be 28:33:00<o:p></o:p>
A7: 2010-0-02 16:48:00 05:33:00 must be 29:33:00<o:p></o:p>
A8: 2010-0-03 10:16:00 23:01:00 must be 47:01:00<o:p></o:p>
...<o:p></o:p>
I tried different methods such as<o:p></o:p>
=INT(A2-A$1)&"days,"&TEXT(MOD(A2-A$1,1)*24,"0.00")&"hours"<o:p></o:p>
<o:p></o:p>
but it is not useful for me since the results are in text format which can't be used for next step calculations and also bc it gives me d:mm:ss format while I need [h]:mm (days in the form of hours).:confused:
<o:p></o:p>
Thank you for your help in advance. <o:p></o:p>
Elham<o:p></o:p>
<o:p> </o:p>
<o:p> </o:p>
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
What are the contents of column A? Is it the time and date? What date is 2010-0-02 supposed to be ( month=0 )?
 
Upvote 0
If A1 and B1 has the date, then try B1-A1.

Format the target cell (where you write the formula) as below.
Category: Custom
Type : [h]:mm

If you enclose the h in square bracket, it will work even if the duration is more than 24 hours.
 
Upvote 0
Hi Glenn.
I used "A" column for naming only. The second column is date, the third is time and the last column is the interval time resulted from IF statement.

A3: 2010-0-01 15:47:00 04:32:00<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:eek:ffice:eek:ffice" /><o:p></o:p>
Name: Date time interval

Date is 2010-09-02 (month Sep.) 2010-0-02 is the typing mistake.

Tanx.
 
Upvote 0

Forum statistics

Threads
1,214,833
Messages
6,121,868
Members
449,053
Latest member
Mesh

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top