Count occurances of something in a list, but also only if another column doesn't have something in it

GodzFire

New Member
Joined
Apr 30, 2018
Messages
20
Hello, suppose the following: I have a list of various departments. I want to count how many times each department shows up in a list. However, I am also only looking for it to be counted if another separate column doesn't have an 'x' in it.

What formula could I use for that? Example below:


A x
B
C
D x
A
B
C x
D
C
B
A x

A 1
B 3
C 2
D 1
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
I had seen and looked at that page, however I openly admit I struggle with formulas, which is why I was hoping someone could kindly assist me here.
 
Upvote 0
How about


Excel 2013 32 bit
ABC
1Ax1
2B3
3C2
4Dx1
5A
6B
7Cx
8D
9C
10B
11Ax
Sheet2
Cell Formulas
RangeFormula
C1=COUNTIFS(A$1:A$11,A1,B$1:B$11,"")
 
Upvote 0
AxA1
BB3
CC2
DxD1
A
B
Cx
D
C
B
Ax

<tbody>
</tbody>

Let A2:B12 house the sample you posted.

In E2 control+shift+enter, not just enter, and copy down:
Rich (BB code):
=IFERROR(INDEX($A$2:$A$12,SMALL(IF(FREQUENCY(IF($A$2:$A$12<>"",MATCH($A$2:$A$12,$A$2:$A$12,0)),
    ROW($A$2:$A$12)-ROW(INDEX($A$2:$A$12,1,1))+1),ROW($A$2:$A$12)-ROW(INDEX($A$2:$A$12,1,1))+1),
    ROWS($E$2:E2))),"")

In F2 just enter and copy down:
Rich (BB code):
=COUNTIFS($A$2:$A$12,E2)-COUNTIFS($A$2:$A$12,E2,$B$2:$B$12,"x")
 
Upvote 0
Sorry, I didn't explain myself accurately enough, let me try again:

SHEET1

A
B
C
D-O
P
A
other data
other dataetc
x
B
other dataother data
etc
C
other data
other dataetc
D
other dataother data
etc
x
A
other data
other data
etc
B
other dataother data
etc
C
other data
other data
etcx
D
other data
other data
etc
C
other dataother dataetc
B
other data
other data
etc
A
other data
other data
etc
x

<tbody>
</tbody>

SHEET2
A 1
B 3
C 2
D 1

Then on another separate spreadsheet tab (ie SHEET 2), it would show the total count not counting any with an X. Does that make sense?
 
Upvote 0
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
1
Aother dataother dataetcetcetcetcetcetcetcetcetcetcetcetcxSheet1
2
Bother dataother dataetcetcetcetcetcetcetcetcetcetcetcetc
3
Cother dataother dataetcetcetcetcetcetcetcetcetcetcetcetc
4
Dother dataother dataetcetcetcetcetcetcetcetcetcetcetcetcx
5
Aother dataother dataetcetcetcetcetcetcetcetcetcetcetcetc
6
Bother dataother dataetcetcetcetcetcetcetcetcetcetcetcetc
7
Cother dataother dataetcetcetcetcetcetcetcetcetcetcetcetcx
8
Dother dataother dataetcetcetcetcetcetcetcetcetcetcetcetc
9
Cother dataother dataetcetcetcetcetcetcetcetcetcetcetcetc
10
Bother dataother dataetcetcetcetcetcetcetcetcetcetcetcetc
11
Aother dataother dataetcetcetcetcetcetcetcetcetcetcetcetcx

<tbody>
</tbody>

A
B
C
D
1
A
1​
Sheet2
2
B
3​
3
C
2​
4
D
1​

<tbody>
</tbody>

Sheet2

B1=COUNTIFS(Sheet1!$A$1:$A$11,Sheet2!$A1,Sheet1!$P$1:$P$11,"<>"&Sheet1!$P$1) copy down

 
Upvote 0

Forum statistics

Threads
1,215,545
Messages
6,125,450
Members
449,227
Latest member
Gina V

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top