Count unique values within a hourly time range

legend2009

New Member
Joined
Aug 9, 2013
Messages
2
Hello,

I need to count how many unique "operator codes" are active within certain intervals throughout the day. I do not want to use a pivot table. I've failed trying to adapt similar formulas for date ranges. Any ideas? Sample data is below. For example, for time range 7:00 to 8:00 AM, there are 5 rows but only 3 unique "operator codes".

[TABLE="width: 306"]
<tbody>[TR]
[TD]Arrival Time[/TD]
[TD]Operator[/TD]
[/TR]
[TR]
[TD]2:30 PM[/TD]
[TD]BBB[/TD]
[/TR]
[TR]
[TD]9:47 AM[/TD]
[TD]BBB[/TD]
[/TR]
[TR]
[TD]6:45 AM[/TD]
[TD]AAA[/TD]
[/TR]
[TR]
[TD]7:34 AM[/TD]
[TD]BBB[/TD]
[/TR]
[TR]
[TD]7:47 AM[/TD]
[TD]AAA[/TD]
[/TR]
[TR]
[TD]7:50 AM[/TD]
[TD]BBB[/TD]
[/TR]
[TR]
[TD]7:32 AM[/TD]
[TD]BBB[/TD]
[/TR]
[TR]
[TD]2:27 PM[/TD]
[TD]AAA[/TD]
[/TR]
[TR]
[TD]2:32 PM[/TD]
[TD]AAA[/TD]
[/TR]
[TR]
[TD]7:45 AM[/TD]
[TD]CCC[/TD]
[/TR]
[TR]
[TD]8:45 AM[/TD]
[TD]BBB[/TD]
[/TR]
[TR]
[TD]2:37 PM[/TD]
[TD]AAA[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
Just figured it out. Here is an example formula for anyone looking later:

=SUM(IF(FREQUENCY(IF(A1:A9>=TIME(7,0,0),IF(A1:A9<=TIME(8,0,0),MATCH("~"&B1:B9,B1:B9&"",0))),ROW(B1:B9)-ROW(B1)+1),1))

My times are in column A and the data is in column B.

This does require CTRL - SHIFT - ENTER.
 
Upvote 0

Forum statistics

Threads
1,223,243
Messages
6,170,964
Members
452,371
Latest member
Frana

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