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".

Arrival TimeOperator
2:30 PMBBB
9:47 AMBBB
6:45 AMAAA
7:34 AMBBB
7:47 AMAAA
7:50 AMBBB
7:32 AMBBB
2:27 PMAAA
2:32 PMAAA
7:45 AMCCC
8:45 AMBBB
2:37 PMAAA

<tbody>
</tbody>
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
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,215,727
Messages
6,126,512
Members
449,316
Latest member
sravya

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