Averaging time calculations

jkaler

New Member
Joined
May 17, 2018
Messages
2
Hello there - new member here...

Hoping someone has a simple solution or direction to offer. The question is this: I have two columns of date data consisting of dd/mm/yy hh:mm:ss. One column is a start time the second is end time. I am calculating the time difference across the row just fine, with a condition that a specific value is present in a third cell in that row. If the specific value is not present, the time calculation result is 0:00:00.

What I am now having troubles with is calculating the average time calculated down the entire column while skipping cells with 0:00:00...

So it would look like this:
[TABLE="width: 471"]
<colgroup><col><col><col><col></colgroup><tbody>[TR]
[TD="align: left"]Start Time[/TD]
[TD="align: left"]End Time[/TD]
[TD="align: left"]Condition[/TD]
[TD="align: left"]Time difference[/TD]
[/TR]
[TR]
[TD="align: right"]10/7/17 5:43 PM[/TD]
[TD="align: right"]5/17/18 3:19 PM[/TD]
[TD="align: left"]Open[/TD]
[TD="align: right"]0[/TD]
[/TR]
[TR]
[TD="align: right"]11/9/17 5:19 PM[/TD]
[TD="align: right"]5/17/18 3:18 PM[/TD]
[TD="align: left"]Closed[/TD]
[TD="align: left"]07:06:21:59:00[/TD]
[/TR]
[TR]
[TD="align: right"]3/2/18 4:11 PM[/TD]
[TD="align: right"]5/17/18 3:18 PM[/TD]
[TD="align: left"]Closed[/TD]
[TD="align: left"]03:15:23:07:00[/TD]
[/TR]
[TR]
[TD="align: right"]4/20/18 3:39 PM[/TD]
[TD="align: right"]5/17/18 3:18 PM[/TD]
[TD="align: left"]Open[/TD]
[TD="align: right"]0
[/TD]
[/TR]
</tbody>[/TABLE]

The formula I am using to calculate the time difference is: =IF(C4="Closed", (TEXT(B4-A4,"MM:DD:hh:mm:ss")),0)

So now what I want to do is calculate the average time difference to not include the 0's


Any ideas?
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
Welcome to the forum.

This is one idea. Forget trying the approach where function TEXT is required: simply have the time difference be a blank instead of zero and format the Time Difference column as MM:DD:hh:mm:ss


Book1
ABCD
1Start TimeEnd TimeConditionTime difference
210/07/17 17:435/17/18 15:19Open 
311/09/17 17:195/17/18 15:18Closed07:06:21:59:00
43/02/18 16:115/17/18 15:18Closed03:15:23:07:00
54/20/18 15:395/17/18 15:18Open
6Total:09:20:21:06:00
7Average:05:11:10:33:00
Sheet70
Cell Formulas
RangeFormula
D2=IF(C2="Closed", B2-A2,"")
D6=SUM(D2:D5)
D7=AVERAGE(D2:D5)
 
Upvote 0
@jkaler - By using the TEXT function the way you did per my calculation your time difference is wrong. Best to use something like DRSteele suggested.

Wouldn't the time difference be:
Excel Workbook
ABCDE
1Start TimeEnd TimeConditionTime differenceShouldn't it be??
210/7/2017 17:435/17/2018 15:19Open00
311/9/2017 17:195/17/2018 15:18Closed07:06:21:59:006 months 7 days 21 Hours 59 mins 00 sec
43/2/2018 16:115/17/2018 15:18Closed03:15:23:07:002 months 14 days 23 Hours 7 mins 00 sec
54/20/2018 15:395/17/2018 15:18Open00
Sheet




[TABLE="class: cms_table, width: 471"]
[TR]
[TD="align: right"][/TD]
[TD="align: left"][/TD]
[TD="align: left"][/TD]
[/TR]
[/TABLE]
 
Upvote 0

Forum statistics

Threads
1,222,688
Messages
6,167,644
Members
452,127
Latest member
jayneecm

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