Thread: Counting words
View Single Post
  #2   Report Post  
Max
 
Posts: n/a
Default

Assume source data is in cols A and B, in A2:B100

Assume C1 & D1 will be reserved for input of the pet and the owner's name
e.g.: in C1: cat, in D1: Pet Owner 1

Put in say, C2:
=IF(OR(C1="",D1=""),"",SUMPRODUCT((A2:A100=C1)*(B2 :B100=D1)))

C2 will return the desired count result for the inputs in C1 and D1

Adapt the ranges in cols A and B to suit, but note that we can't use entire
col references in SUMPRODUCT
--
Rgds
Max
xl 97
---
GMT+8, 1° 22' N 103° 45' E
xdemechanik <atyahoo<dotcom
----
"johanl" wrote in
message ...

I have two columns.

The first one with four diffrent words (cat, dog, rabbit, fish, horse
and bird), and the second column have nine different names.

The worsheet works so that the first column shows what pet the owner
(In the second column) has . It´s a pretty long list...

I want to make a function that only counts when the first column says
"cat" and the second says"Pet Owner 1".

Hope someone understand what I´m rambling about... :)


--
johanl
------------------------------------------------------------------------
johanl's Profile:

http://www.excelforum.com/member.php...o&userid=25740
View this thread: http://www.excelforum.com/showthread...hreadid=391512