Formula to count unique Values in a date range needed.

Randolf

New Member
Joined
Jun 7, 2010
Messages
3
Hi,

I am trying to count the number of unique vaules in column B that fall with in a date range in column A.

For example
A: B:
12/31/2009 1111111
1/5/2010 1111111
1/5/2010 1111111
5/31/2010 2222222
5/31/2010 1111111

If the date range is 1/5 to 5/31 the result would be 3.

I apperciate any help.
I have tried countif and if statement. I assume that this may be an array but I have not used them before.
 
Hi
Dom why u use # in ur formulla
Code:
&"#"&
and in some cases i see u and aladin use another way
Code:
&"|"&
:confused:

We don't want to confound records like

A1: 1, B1: 11
A2: 11, B2: 1

by copying down

=A1&B1

A separator like "|" or "#" avoids having

111

instead of 1|11 and 11|1.
 
Upvote 0

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
Thanx Aladin
that is mean we just used this kind of CONCATENATION when we need to use two or more columns as one criteria
 
Upvote 0
Thanx Aladin
that is mean we just used this kind of CONCATENATION when we need to use two or more columns as one criteria

Yes, because concatenation without a separator can lead to errors in processing.

Mind you, the dinstinction is a default assumption here.
 
Last edited:
Upvote 0
Hi Aladin
Sorry i didn't get the idea :(

The default assumption is that we want to have the parts/items recognizable (distinct) after we glue them together. Hence a separator. It's imaginable that there can be situations in which we don't want the distinction.
 
Upvote 0
In that case, try the following instead...

=SUM(IF(FREQUENCY(IF($A$2:$A$10>=D2,IF($A$2:$A$10<=E2,MATCH(INT($A$2:$A$10)&"#"&INT($B$2:$B$10),INT($A$2:$A$10)&"#"&INT($B$2:$B$10),0))),ROW($A$2:$A$10)-ROW($A$2)+1)>0,1))

...confirmed with CONTROL+SHIFT+ENTER.

Correction, no need to subject Column B to INT...

=SUM(IF(FREQUENCY(IF($A$2:$A$10>=D2,IF($A$2:$A$10<=E2,MATCH(INT($A$2:$A$10)&"#"&$B$2:$B$10,INT($A$2:$A$10)&"#"&
$B$2:$B$10,0))),ROW($A$2:$A$10)-ROW($A$2)+1)>0,1))

...confirmed with CONTROL+SHIFT+ENTER.
 
Upvote 0

Forum statistics

Threads
1,216,460
Messages
6,130,771
Members
449,589
Latest member
Hana2911

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