Count If with multiple criteria and unique values

dixon1983

Board Regular
Joined
Apr 23, 2005
Messages
175
Hi,
I dont know if this is possible or not but thought I'd ask anyway.

I have a sheet of data and want to run a count on the values in Column A with the following criteria:

- If the value in column B is repeated then the value in column A can only be counted once...
- Column C must equal 'M'.


Example:
A.....B.....C
1.....42....M
1.....42....M
2.....41....A
2.....41....M
1.....56....M


In this example 1 would be counted 2 times, and 2 would be counted once.

I have about 15 sheets of data like this and would like a master sheet to look into each sheet and give me a count of each so id prefer to not use the advanced filter => unique variables option if possible.

Any help would be greatly appreciated.

Dixon.
 
@KamCheng

[TABLE="class: grid, width: 456"]
<tbody>[TR]
[TD]Count of Unique Accounts[/TD]
[TD]201701[/TD]
[TD]201702[/TD]
[TD]201703[/TD]
[TD]201704[/TD]
[/TR]
[TR]
[TD]Inbound[/TD]
[TD="align: right"]2[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]2[/TD]
[/TR]
[TR]
[TD]Outbound[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]2[/TD]
[/TR]
[TR]
[TD]Door to Door[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[/TR]
</tbody>[/TABLE]

In B2 control+shift+enter, not just enter, copy across, and down:

=SUM(IF(FREQUENCY(IF(Channel=$A2,IF(CCYYMM=B$1,Account)),Account),1))

Thank you! This worked perfectly for what I was trying to accomplish.
 
Upvote 0

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
E2: Mr.X
E3: Mr.Y

F2, control+shift+enter, not just enter, and copy down:
Rich (BB code):
=SUM(IF(FREQUENCY(IF($A$2:$A$9<>"",IF($B$2:$B$9=E2, 
    MATCH("~"&$A$2:$A$9,$A$2:$A$9&"",0))),
       ROW($A$2:$A$9)-ROW($A$2)+1),1))
How do I do the same if I have 4 columns instead? Let's say it looks like this:

"Letters" =Column
"_" =separates data per column

Table 1
ColA_ColB_ColC_ColD
Row2-Accounting_North_Regular_blue
Row3-HRDept_East_Temporary_blue
Row4-Accounting_East_Regular_green
Row5-Merchandising_West_Regular_blue
Row6-Utility_South_Temporary_red
Row7-Security_North_Regular_blue
Row8-Security_North_Regular_blue
Row9-Merchandising_West_Regular_blue
Row10-Utility_South_Temporary_red
Row11-Security_North_Regular_blue
Row12-Accounting_North_Regular_blue
Row13-HRDept_East_Temporary_blue
Row14-HRDept_East_Regular_blue
Row15-Security_North_Regular_green
Row16-Accounting_North_Regular_blue
Row17-Security_North_Regular_blue
Row18-Accounting_North_Regular_blue


What I want to know is the number of colors (unique values; disregarding duplicate data) are there available that are under "Regular" that are also "North" that are under "Security".

Thanks!
 
Upvote 0
How do I do the same if I have 4 columns instead? […]


Book1
ABCDE
1
2AccountingNorthRegularbluesecurity
3HRDeptEastTemporarybluenorth
4AccountingEastRegulargreenregular
5MerchandisingWestRegularblue2
6UtilitySouthTemporaryred
7SecurityNorthRegularblue
8SecurityNorthRegularblue
9MerchandisingWestRegularblue
10UtilitySouthTemporaryred
11SecurityNorthRegularblue
12AccountingNorthRegularblue
13HRDeptEastTemporaryblue
14HRDeptEastRegularblue
15SecurityNorthRegulargreen
16AccountingNorthRegularblue
17SecurityNorthRegularblue
18AccountingNorthRegularblue
19
Sheet1


In E5 control+shift+enter, not just enter:

=SUM(IF(FREQUENCY(IF($D$2:$D$18<>"",IF($A$2:$A$18=E2,IF($B$2:$B$18=E3,IF($C$2:$C$18=E4,MATCH("~"&$D$2:$D$18,$D$2:$D$18&"",0))))),
ROW($D$2:$D$18)-ROW($D$2)+1),1))
 
Upvote 0
ABCDE
AccountingNorthRegularbluesecurity
HRDeptEastTemporarybluenorth
AccountingEastRegulargreenregular
MerchandisingWestRegularblue
UtilitySouthTemporaryred
SecurityNorthRegularblue
SecurityNorthRegularblue
MerchandisingWestRegularblue
UtilitySouthTemporaryred
SecurityNorthRegularblue
AccountingNorthRegularblue
HRDeptEastTemporaryblue
HRDeptEastRegularblue
SecurityNorthRegulargreen
AccountingNorthRegularblue
SecurityNorthRegularblue
AccountingNorthRegularblue

<colgroup><col style="width: 25pxpx"><col><col><col><col><col></colgroup><thead>
</thead><tbody>
[TD="align: center"]1[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]2[/TD]

[TD="align: center"]3[/TD]

[TD="align: center"]4[/TD]

[TD="align: center"]5[/TD]

[TD="align: right"]2[/TD]

[TD="align: center"]6[/TD]

[TD="align: right"][/TD]

[TD="align: center"]7[/TD]

[TD="align: right"][/TD]

[TD="align: center"]8[/TD]

[TD="align: right"][/TD]

[TD="align: center"]9[/TD]

[TD="align: right"][/TD]

[TD="align: center"]10[/TD]

[TD="align: right"][/TD]

[TD="align: center"]11[/TD]

[TD="align: right"][/TD]

[TD="align: center"]12[/TD]

[TD="align: right"][/TD]

[TD="align: center"]13[/TD]

[TD="align: right"][/TD]

[TD="align: center"]14[/TD]

[TD="align: right"][/TD]

[TD="align: center"]15[/TD]

[TD="align: right"][/TD]

[TD="align: center"]16[/TD]

[TD="align: right"][/TD]

[TD="align: center"]17[/TD]

[TD="align: right"][/TD]

[TD="align: center"]18[/TD]

[TD="align: right"][/TD]

[TD="align: center"]19[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

</tbody>
Sheet1

In E5 control+shift+enter, not just enter:

=SUM(IF(FREQUENCY(IF($D$2:$D$18<>"",IF($A$2:$A$18=E2,IF($B$2:$B$18=E3,IF($C$2:$C$18=E4,MATCH("~"&$D$2:$D$18,$D$2:$D$18&"",0))))),
ROW($D$2:$D$18)-ROW($D$2)+1),1))

Hi! Thank you very much for getting back to me instantly. I really appreciate it.
 
Upvote 0

Forum statistics

Threads
1,223,923
Messages
6,175,392
Members
452,640
Latest member
steveridge

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