Another Excel question: counting cells if they meet multiple conditions

I’ve been stuck on this for a little while. Here’s my example:

A B
blah blah
blip blah
blah blip
bleck blah
blah blah

I only want to count the number of “blah blah” pairs. Is there a way I can count the number of instances of A=something AND B=something? I tried:

=sum(and(countif(A1:A5,“blah”),countif(B1:B5=“blah”))), but that doesn’t work, unsurprisingly.

The easiest way to do this is to create a column c with an ‘if’ formula in, scoring either 1 if true or 0 if false, and then simply sum that column. If you’re looking to count every instance or column A = column B, then create column c and enter the formula:

=IF(A2=B2,1,0)

If you exclusively want to count the instances of A = blah and B = blah, enter the formula:

=IF(AND(A2=“blah”,B2=“blah”),1,0)

Then (in either case) just sum the contents of column C.

Yeah, I thought about that solution. I was hoping there was something else I could do instead though.

This seems to work:

=SUMPRODUCT((A1:A15=“blah”)*(B1:B15=“blah”))

You, sir, are a genius.