COUNTIF corresponding with other column

awembridge

New Member
Joined
Sep 12, 2017
Messages
7
Hi all,
I am trying to COUNT the values in a column, but only if they do NOT correspond to a duplicate value in a different column.

In other words, only count the Xs for only ONE instance of 101, 102 or 103 in the example below.
This is well beyond me and my powers, but could anyone kindly assist?

<style type="text/css"><!--td {border: 1px solid #ccc;}br {mso-data-placement:same-cell;}--></style>
(Desired)676
COUNTA986
FredPaulIan
101XXX
102XXX
103XX
104X
105X
106X
101X
107XX
101X
108X
109XX
110XXX
102X
103X

<colgroup><col style="width: 120px"><col width="120"><col width="120"><col width="120"></colgroup><tbody>
</tbody>
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
Can you explain which items are counted for each of your three results?
 
Upvote 0
It is not clear, at least for me, how to get the desired results: 6 for Paul, 7 for Fred and 6 for Ian.
Could you explain the logic to get such values?

M.
 
Upvote 0
In B1 control+shift+enter, not just enter, and copy across:

=SUM(IF(FREQUENCY(IF(ISNUMBER($A$4:$A$17),IF(B$4:B$17="X",$A$4:$A$17)),$A$4:$A$17),1))
 
Upvote 0
I think i understand what you are looking for.

See if this does what you need

A
B
C
D
1
(Desired)​
6​
7​
6​
2
COUNTA​
9​
8​
6​
3
Fred​
Paul​
Ian​
4
101​
X​
X​
X​
5
102​
X​
X​
X​
6
103​
X​
X​
7
104​
X​
8
105​
X​
9
106​
X​
10
101​
X​
11
107​
X​
X​
12
101​
X​
13
108​
X​
14
109​
X​
X​
15
110​
X​
X​
X​
16
102​
X​
17
103​
X​

<tbody>
</tbody>


Array formula in B1 copied across
=SUM(IF(FREQUENCY(IF(B$4:B$17="X",MATCH($A$4:$A$17,$A$4:$A$17,0)),ROW($A$4:$A$17)-ROW($A$4)+1),1))
Ctrl+Shift+Enter

M.
 
Upvote 0
Thanks for replying, let me try to explain more clearly.

Fred has 3 instances of 'X' corresponding to '101'. I want to count only the first of these.
Fred also has 2 instances of 'X' corresponding to '102'. I want to count only the first of these.
Fred also has instances of 'X' corresponding to '103' '104' '107' '110'.
Thus, my desired value for Fred is 6, (though there are 9 instances of 'X', I only want the first of each.)

Similarly, Paul has 2 instances of 'X' for '103'. I only want to count the first.

Ian only has instances of 'X' a maximum of once corresponding to 101-110. (Thus the COUNTA is equal to my desired output.)


My practical application is actually many more rows and columns, which is why I have tried to simplify it with this example.
Many thanks!
 
Upvote 0
If all the values in column A are numbers, not text, try the formula suggested by Aladin in post #4 . Otherwise, use the formula in post #5 .

M.
 
Upvote 0

Forum statistics

Threads
1,216,079
Messages
6,128,687
Members
449,464
Latest member
againofsoul

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