unique values in an array

keresztesi

Board Regular
Joined
Aug 14, 2017
Messages
64
Hi,

I have the following table:

In column "A" : dates (dd.mm.yyyy)
In column "E": times (hh:mm)

I'd like to have the followings:
18:00 <= Times < 22:00

How many unique days match that criteria?

Thx in advance
 

Some videos you may like

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result

Domenic

MrExcel MVP
Joined
Mar 10, 2004
Messages
19,406
To return a count of unique times that are greater than or equal to 18:00 and less than or equal to 22:00, try the following formula that needs to be confirmed with CONTROL+SHIFT+ENTER...

=SUM(IF(FREQUENCY(IF(E2:E100>="18:00:00"+0,IF(E2:E100<="22:00:00"+0,E2:E100)),E2:E100)>0,1))

or

=SUM(IF(FREQUENCY(IF(E2:E100>=G2,IF(E2:E100<=H2,E2:E100)),E2:E100)>0,1))

...where G2 contains the start time, and H2 contains the end time. To include the date, try the following formula instead that also needs to be confirmed with CONTROL+SHIFT+ENTER...

=SUM(IF(FREQUENCY(IF(A2:A100+E2:E100>="1/15/2017 18:00:00"+0,IF(A2:A100+E2:E100<="1/15/2017 22:00:00"+0,A2:A100+E2:E100)),A2:A100+E2:E100)>0,1))

or

=SUM(IF(FREQUENCY(IF(A2:A100+E2:E100>=G2+H2,IF(A2:A100+E2:E100<=G2+I2,A2:A100+E2:E100)),A2:A100+E2:E100)>0,1))

...where G2 contains the date, H2 contains the start time, and I2 contains the end time. Adjust the ranges accordingly. However, try to avoid using whole column references, since it would likely slow down the calculations considerably.

Hope this helps!
 

keresztesi

Board Regular
Joined
Aug 14, 2017
Messages
64
Hi Domenic,

thx for your reply.
I tried your 3rd formula, but it gives me "0" as result. :(

Any other ideas?

Thx
 

keresztesi

Board Regular
Joined
Aug 14, 2017
Messages
64
Ok,

I figured it out. It works well with this formula:

=SUM(((FREQUENCY(IF('[bizerba2_du.xls]BEVITEL '!$E10:$E1000>=0,75;1;0)*IF('[bizerba2_du.xls]BEVITEL '!$E10:$E1000<0,916666666666667;1;0)*(COUNTIF('[bizerba2_du.xls]BEVITEL '!$A10:$A1000;">"&'[bizerba2_du.xls]BEVITEL '!$A10:$A1000)+1);ROW('[bizerba2_du.xls]BEVITEL '!$A$10:$A$1000)-ROW('[bizerba2_du.xls]BEVITEL '!$A$10)))*(ROW('[bizerba2_du.xls]BEVITEL '!$A$10:$A$1001)-ROW('[bizerba2_du.xls]BEVITEL '!$A$10))>0)*1)

BUT!

It works only when the external reference file is open!
Is there a way to use it without opening all the external files?

Thx
 

Domenic

MrExcel MVP
Joined
Mar 10, 2004
Messages
19,406
Hi Domenic,

thx for your reply.
I tried your 3rd formula, but it gives me "0" as result. :(

Any other ideas?

Thx

Can you post about 10 rows of sample data, provide the expected results based on the posted data, and provide the exact formula that you tried?
 

Watch MrExcel Video

Forum statistics

Threads
1,122,232
Messages
5,594,962
Members
413,954
Latest member
mrsandy

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
Top