# CountA(if

#### srdavisgb

##### New member
I am trying to count numbers, both positive and negative (including zero) in a column based on criteria. Because the range of numbers, countif does not seem to be appropriate. I tried the following formula: =COUNTA(IF(\$A\$2:\$A\$20=\$D2,\$B\$2:\$B\$20)). Column A contains 3 "A's" with a number in column B. But, the formula result is 19.

Any assistance you can provide with this challenge would be greatly appreciated.

I have attached a file with the example data and formula.

#### Attachments

• Counta Example.xlsx
13.4 KB · Views: 10
Why not just use SUMIFS

=SUMIFS(\$B\$2:\$B\$20,\$A\$2:\$A\$20,D2)

=SUMIFS(\$B\$2:\$B\$20,\$A\$2:\$A\$20,D2) returns 25. I am not trying to sum the numbers only count them.

The results I'm trying to get in the example would be 3-A's, 3-B's, 2-C's and 2-D's.

So you want to count the occurances of A,B,C and D in column A, If they have a something beside them in column B, while skipping the blanks.

try =COUNTIFS(A:A,D2,B:B,"<>"&"")

Should give you
 Criteria No. A 3 B 3 C 2 D 2