View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default CountIf for two columns

SUMPRODUCT returns an array of True/False values. The -- is to coerce these
into 0/1 values that can be added up.

Could I suggest that you look at this previous NG posting where Ken Wright
gives a pretty thorough explanation

http://tinyurl.com/v85r

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Yakimoto" wrote in message
...
Thanks J.E., this is exactly what I needed.
Could you tell me what are these two minuses for in the formula
(--(A1:A1000=D1) ?

"J.E. McGimpsey" wrote in message
...
One way:

Assume your columns are A & B. Further assume your criteria are in
D1 (for column A) and E1 (for column B):

=SUMPRODUCT(--(A1:A1000=D1),--(B1:B1000=E1))


In article ,
"Yakimoto" wrote:

I have two columns populated with different values.
I would like to count all the cells pair having specific values, i.e.

like
countif function, but for both cells.
For now I am doing this concatenating both columns and after that

performing
CountIf over resulting column.
Another way is to write a piece of code looping and counting, but it

seems
too much for such a simple thing.
Is there any other way of doing that? Without intermediate steps, only

using
one formula?

Thanks,
Yakimo