Counting words

J

johanl

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... :)
 
M

Max

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
 
Top