Tishya Ballaney
Tishya Ballaney

Reputation: 21

Countifs with specified row and column value

Using the data below,

                       HR   SC  HR
Banks                  1    2   2
Insurance              1    5   2
Banks                  2    3   9
Diversified Finance   10    6   7
Banks                  2    4   3
Insurance              8    2   2

I am trying to find the number of times a certain digit shows up for the banks in HR. Have tried to use, countifs and if(and(row="Banks",column="HR"),countif(A1:D8,"1")) but these didn't work.

My goal is to have:

         HR
Banks 1  1
Banks 2  3
Banks 3  1

Any help would be greatly appreciated.

Upvotes: 2

Views: 54

Answers (1)

CallumDA
CallumDA

Reputation: 12113

A SUMPRODUCT formula will work:

=SUMPRODUCT(($A$2:$A$7="Banks")*($B$1:$D$1="HR")*($B$2:$D$7=1))

...or equivalent dynamic formula (as used below)

=SUMPRODUCT(($A$2:$A$7=$A12)*($B$1:$D$1=C$11)*($B$2:$D$7=$B12))

enter image description here

Upvotes: 5

Related Questions