#1   Report Post  
Neville
 
Posts: n/a
Default Count or Dcount

I have the following database table in Excel:

A B
1 1 Sep John
2 1 Sep Fred
3 1 Sep John
4 2 Sep John
5 3 Sep Fred
6 3 Sep John

How can I count the number of unique dates in which John applies? The answer
should be 3, i.e. 1 Sep, 2 Sep and 3 Sep.

  #2   Report Post  
Bob Phillips
 
Posts: n/a
Default

=SUM(IF(FREQUENCY(IF((B2:B20="John"),A2:A20),IF((B 2:B20="John"),A2:A20))0,1
,0))

this is an array formula, so commit with Ctrl-Shift-Enter.

--
HTH

Bob Phillips

"Neville" wrote in message
...
I have the following database table in Excel:

A B
1 1 Sep John
2 1 Sep Fred
3 1 Sep John
4 2 Sep John
5 3 Sep Fred
6 3 Sep John

How can I count the number of unique dates in which John applies? The

answer
should be 3, i.e. 1 Sep, 2 Sep and 3 Sep.



  #3   Report Post  
Neville
 
Posts: n/a
Default

Bob, you are a genius! Thanks very much.

Neville
  #4   Report Post  
Jack Sons
 
Posts: n/a
Default

Bob,

I put the data in A2:B7.
With key F9 I see that
FREQUENCY(IF((B2:B7="John"),A2:A7),IF((B2:B7="John "),A2:A7))
results in {2\0\1\1\0}
but I don't understand why. Please enlighten me.

Jack Sons
The Netherlands

"Bob Phillips" schreef in bericht
...
=SUM(IF(FREQUENCY(IF((B2:B20="John"),A2:A20),IF((B 2:B20="John"),A2:A20))0,1
,0))

this is an array formula, so commit with Ctrl-Shift-Enter.

--
HTH

Bob Phillips

"Neville" wrote in message
...
I have the following database table in Excel:

A B
1 1 Sep John
2 1 Sep Fred
3 1 Sep John
4 2 Sep John
5 3 Sep Fred
6 3 Sep John

How can I count the number of unique dates in which John applies? The

answer
should be 3, i.e. 1 Sep, 2 Sep and 3 Sep.





  #5   Report Post  
Bob Phillips
 
Posts: n/a
Default

Hi Jack,

What it is doing in essence is taking every item in A2:A7 in turn, and
checking how often that item occurs in A2:A&, but only if the corresponding
cell in B also equals John. So, where you see 2, that is the 3rd Sep for
John, the two occurrences of 1 relate to the 1st and 2nd Sep entries for
John, and the tow 0 occurrences relates to the Fred entries. The frequencies
are checked for greater than 0, and summed as 1 for those instances.

--
HTH

Bob Phillips

"Jack Sons" wrote in message
...
Bob,

I put the data in A2:B7.
With key F9 I see that
FREQUENCY(IF((B2:B7="John"),A2:A7),IF((B2:B7="John "),A2:A7))
results in {2\0\1\1\0}
but I don't understand why. Please enlighten me.

Jack Sons
The Netherlands

"Bob Phillips" schreef in bericht
...

=SUM(IF(FREQUENCY(IF((B2:B20="John"),A2:A20),IF((B 2:B20="John"),A2:A20))0,1
,0))

this is an array formula, so commit with Ctrl-Shift-Enter.

--
HTH

Bob Phillips

"Neville" wrote in message
...
I have the following database table in Excel:

A B
1 1 Sep John
2 1 Sep Fred
3 1 Sep John
4 2 Sep John
5 3 Sep Fred
6 3 Sep John

How can I count the number of unique dates in which John applies? The

answer
should be 3, i.e. 1 Sep, 2 Sep and 3 Sep.









  #6   Report Post  
John Moore
 
Posts: n/a
Default

A simple way is to do a Countif
=Countif(B1:B6,"John")

"Neville" wrote:

I have the following database table in Excel:

A B
1 1 Sep John
2 1 Sep Fred
3 1 Sep John
4 2 Sep John
5 3 Sep Fred
6 3 Sep John

How can I count the number of unique dates in which John applies? The answer
should be 3, i.e. 1 Sep, 2 Sep and 3 Sep.

  #7   Report Post  
Myrna Larson
 
Posts: n/a
Default

I was about to say the same thing, but, since Bob usually knows what he's
doing, I double-checked the original message, which specifies UNIQUE DATES.
COUNTIF will give a result of 4, since there are 2 entries for 1 Sep, and the
OP says he wants a result of 3.

Score 1 for Bob, 0 for Myrna and John <g.


On Sun, 18 Sep 2005 11:44:10 -0700, "John Moore"
wrote:

A simple way is to do a Countif
=Countif(B1:B6,"John")

"Neville" wrote:

I have the following database table in Excel:

A B
1 1 Sep John
2 1 Sep Fred
3 1 Sep John
4 2 Sep John
5 3 Sep Fred
6 3 Sep John

How can I count the number of unique dates in which John applies? The

answer
should be 3, i.e. 1 Sep, 2 Sep and 3 Sep.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Count Intervals of Filtered TEXT values in Column and Return Count across a Row Sam via OfficeKB.com Excel Worksheet Functions 9 July 31st 05 03:37 AM
Count Position of Filtered TEXT cells in a column Sam via OfficeKB.com Excel Worksheet Functions 8 May 18th 05 04:23 AM
Count Position of Filtered TEXT cells in a column Sam via OfficeKB.com Excel Worksheet Functions 0 May 15th 05 08:14 PM
Match Last Occurrence of two numbers and Count to Previous Occurence Sam via OfficeKB.com Excel Worksheet Functions 33 April 4th 05 02:17 PM
SUMPRODUCT Formula to Count Row of data Below Matched Criteria Sam via OfficeKB.com Excel Worksheet Functions 8 February 3rd 05 01:37 AM


All times are GMT +1. The time now is 12:10 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"