Excell Time Occurence

TurtleontheRun

New Member
Joined
Sep 7, 2017
Messages
6
Hello all,

I've been trying to figure out a way to tally how many times an occurrence happens between a time frame. It's a little hard to explain, so I've provided an example below.

The columns for time run from J4 to J83. I need a formula that would be calculate that a time appeared say between 1600-1659, 4 times.

I apologise for the confusing explanation. I'll be happy to answer any questions. I have tried numerous countif/countifs functions after a strenuous search and haven't been able to adjust it to either function properly or to count correctly. Any suggestions would be greatly appreciated.



[TABLE="width: 116"]
<tbody>[TR]
[TD="class: xl71, width: 154, bgcolor: transparent, colspan: 2"]Reported
[/TD]
[/TR]
[TR]
[TD="class: xl70, bgcolor: transparent"]Time
[/TD]
[TD="class: xl70, bgcolor: transparent"]Date
[/TD]
[/TR]
[TR]
[TD="class: xl68, bgcolor: transparent"]8:05
[/TD]
[TD="class: xl69, bgcolor: transparent"]09/01/2017
[/TD]
[/TR]
[TR]
[TD="class: xl68, bgcolor: transparent"]9:48
[/TD]
[TD="class: xl69, bgcolor: transparent"]09/01/2017
[/TD]
[/TR]
[TR]
[TD="class: xl68, bgcolor: transparent"]11:24
[/TD]
[TD="class: xl69, bgcolor: transparent"]09/01/2017
[/TD]
[/TR]
[TR]
[TD="class: xl68"]12:19
[/TD]
[TD="class: xl69, bgcolor: transparent"]09/01/2017
[/TD]
[/TR]
[TR]
[TD="class: xl68"]12:35
[/TD]
[TD="class: xl69, bgcolor: transparent"]09/01/2017
[/TD]
[/TR]
[TR]
[TD="class: xl68"]12:48
[/TD]
[TD="class: xl69, bgcolor: transparent"]09/01/2017
[/TD]
[/TR]
[TR]
[TD="class: xl68"]16:42
[/TD]
[TD="class: xl69, bgcolor: transparent"]09/01/2017
[/TD]
[/TR]
[TR]
[TD="class: xl68, bgcolor: transparent"]16:42
[/TD]
[TD="class: xl69, bgcolor: transparent"]09/01/2017
[/TD]
[/TR]
[TR]
[TD="class: xl68"]16:05
[/TD]
[TD="class: xl69, bgcolor: transparent"]09/02/2017
[/TD]
[/TR]
[TR]
[TD="class: xl68"]12:17
[/TD]
[TD="class: xl69, bgcolor: transparent"]09/05/2017
[/TD]
[/TR]
[TR]
[TD="class: xl68"]15:06
[/TD]
[TD="class: xl69, bgcolor: transparent"]09/05/2017
[/TD]
[/TR]
[TR]
[TD="class: xl68"]12:11
[/TD]
[TD="class: xl69, bgcolor: transparent"]09/06/2017
[/TD]
[/TR]
[TR]
[TD="class: xl68"]14:33
[/TD]
[TD="class: xl69, bgcolor: transparent"]09/06/2017
[/TD]
[/TR]
[TR]
[TD="class: xl68"]12:37
[/TD]
[TD="class: xl69, bgcolor: transparent"]09/06/2017
[/TD]
[/TR]
[TR]
[TD="class: xl68"]16:20
[/TD]
[TD="class: xl69, bgcolor: transparent"]09/06/2017
[/TD]
[/TR]
</tbody>[/TABLE]

[TABLE="width: 144"]
<tbody>[TR]
[TD="class: xl69, width: 64, bgcolor: transparent"]Time
[/TD]
[TD="class: xl71, width: 64, bgcolor: transparent"]# of reports
[/TD]
[/TR]
[TR]
[TD="class: xl70, bgcolor: transparent"]00:00
[/TD]
[TD="class: xl72, bgcolor: transparent"]0
[/TD]
[/TR]
[TR]
[TD="class: xl70, bgcolor: transparent"]01:00
[/TD]
[TD="class: xl72, bgcolor: transparent"]0
[/TD]
[/TR]
[TR]
[TD="class: xl70, bgcolor: transparent"]02:00
[/TD]
[TD="class: xl72, bgcolor: transparent"]0
[/TD]
[/TR]
[TR]
[TD="class: xl70, bgcolor: transparent"]03:00
[/TD]
[TD="class: xl72, bgcolor: transparent"]0
[/TD]
[/TR]
[TR]
[TD="class: xl70, bgcolor: transparent"]04:00
[/TD]
[TD="class: xl72, bgcolor: transparent"]0
[/TD]
[/TR]
[TR]
[TD="class: xl70, bgcolor: transparent"]05:00
[/TD]
[TD="class: xl72, bgcolor: transparent"]0
[/TD]
[/TR]
[TR]
[TD="class: xl70, bgcolor: transparent"]06:00
[/TD]
[TD="class: xl72, bgcolor: transparent"]0
[/TD]
[/TR]
[TR]
[TD="class: xl70, bgcolor: transparent"]07:00
[/TD]
[TD="class: xl72, bgcolor: transparent"]0
[/TD]
[/TR]
[TR]
[TD="class: xl70, bgcolor: transparent"]08:00
[/TD]
[TD="class: xl72, bgcolor: transparent"]1
[/TD]
[/TR]
[TR]
[TD="class: xl70, bgcolor: transparent"]09:00
[/TD]
[TD="class: xl72, bgcolor: transparent"]1
[/TD]
[/TR]
[TR]
[TD="class: xl70, bgcolor: transparent"]10:00
[/TD]
[TD="class: xl72, bgcolor: transparent"]0
[/TD]
[/TR]
[TR]
[TD="class: xl70, bgcolor: transparent"]11:00
[/TD]
[TD="class: xl72, bgcolor: transparent"]1
[/TD]
[/TR]
[TR]
[TD="class: xl70, bgcolor: transparent"]12:00
[/TD]
[TD="class: xl72, bgcolor: transparent"]6
[/TD]
[/TR]
[TR]
[TD="class: xl70, bgcolor: transparent"]13:00
[/TD]
[TD="class: xl72, bgcolor: transparent"]0
[/TD]
[/TR]
[TR]
[TD="class: xl70, bgcolor: transparent"]14:00
[/TD]
[TD="class: xl72, bgcolor: transparent"]1
[/TD]
[/TR]
[TR]
[TD="class: xl70, bgcolor: transparent"]15:00
[/TD]
[TD="class: xl72, bgcolor: transparent"]1
[/TD]
[/TR]
[TR]
[TD="class: xl70, bgcolor: transparent"]16:00
[/TD]
[TD="class: xl72, bgcolor: transparent"]4
[/TD]
[/TR]
[TR]
[TD="class: xl70, bgcolor: transparent"]17:00
[/TD]
[TD="class: xl72, bgcolor: transparent"]0
[/TD]
[/TR]
[TR]
[TD="class: xl70, bgcolor: transparent"]18:00
[/TD]
[TD="class: xl72, bgcolor: transparent"]0
[/TD]
[/TR]
[TR]
[TD="class: xl70, bgcolor: transparent"]19:00
[/TD]
[TD="class: xl72, bgcolor: transparent"]0
[/TD]
[/TR]
[TR]
[TD="class: xl70, bgcolor: transparent"]20:00
[/TD]
[TD="class: xl72, bgcolor: transparent"]0
[/TD]
[/TR]
[TR]
[TD="class: xl70, bgcolor: transparent"]21:00
[/TD]
[TD="class: xl72, bgcolor: transparent"]0
[/TD]
[/TR]
[TR]
[TD="class: xl70, bgcolor: transparent"]22:00
[/TD]
[TD="class: xl72, bgcolor: transparent"]0
[/TD]
[/TR]
[TR]
[TD="class: xl70, bgcolor: transparent"]23:00
[/TD]
[TD="class: xl72, bgcolor: transparent"]0
[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Suppose your second table is in A2:A25 (00:00 through 23:00). I suggest entering 24:00 (actually 1) into A26, which you can hide. Format A2:A26 as Custom [hh]:mm if you want to display A26.

Then enter the following into B2 and copy down through B25:

=COUNTIFS($J$4:$J$83, ">=" & A2, $J$4:$J$83, "<" & A3)
or
=COUNTIF($J$4:$J$83, "<" & A3) - COUNTIF($J$4:$J$83, "<" & A2)

Format column B as General, if necessary. Use the first formula if the Excel file is saved as "xlsx" or "xlsm". Use the second formula if the Excel file is saved as "xls".

-----

It would be more efficient to use the FREQUENCY function. For example, enter the following into C2 and copy down through C25, which you can hide (and A26 is not needed):

=--TEXT(A2+TIME(0,59,59),"[h]:m:ss")

That presumes that the times in column J are entered as constants, not calculated, and they are accurate to the 1 minute (or 1 second). The double negate ("--") converts text to numeric Excel time. The TEXT function rounds to the internal binary representation of the hour plus 59 min 59 sec. Rounding is important because FREQUENCY compares the binary representation, not the displayed appearance.

Then select B2:B25 and array-enter (press ctrl+shift+Enter instead of just Enter) the following formula:

=FREQUENCY(J4:J83, C2:C25)
 
Upvote 0
No helper columns or rows necessary:


Book1
AB
3Time# of reports
400:000
501:000
602:000
703:000
804:000
905:000
1006:000
1107:000
1208:001
1309:001
1410:000
1511:001
1612:006
1713:000
1814:001
1915:001
2016:004
2117:000
2218:000
2319:000
2420:000
2521:000
2622:000
2723:000
Sheet1
Cell Formulas
RangeFormula
B4=COUNTIFS($J$4:$J$83,">="&$A4,$J$4:$J$83,"<"&$A4+TIME(1,0,0))


WBD
 
Upvote 0
No helper columns or rows necessary:
[....]
=COUNTIFS($J$4:$J$83,">="&$A4,$J$4:$J$83,"<"&$A4+TIME(1,0,0))

Right. Klunk! And for completeness, my other suggestions can be written as:

=COUNTIF($J$4:$J$83, "<" & A2 + TIME(1,0,0)) - COUNTIF($J$4:$J$83, "<" & A2)

=FREQUENCY(J4:J83, --TEXT(A2:A25 + TIME(0,59,59), "[h]:m:ss"))

Again, the FREQUENCY formula is array-entered: select B2:B25 and press ctrl+shift+Enter instead of just Enter.
 
Upvote 0

Forum statistics

Threads
1,224,830
Messages
6,181,225
Members
453,025
Latest member
Hannah_Pham93

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