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

Count of Unique Accounts201701201702201703201704
Inbound2102
Outbound1102
Door to Door1011

<tbody>
</tbody>

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

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
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
1
2AccountingNorthRegularbluesecurity
3HRDeptEastTemporarybluenorth
4AccountingEastRegulargreenregular
5MerchandisingWestRegularblue2
6UtilitySouthTemporaryred
7SecurityNorthRegularblue
8SecurityNorthRegularblue
9MerchandisingWestRegularblue
10UtilitySouthTemporaryred
11SecurityNorthRegularblue
12AccountingNorthRegularblue
13HRDeptEastTemporaryblue
14HRDeptEastRegularblue
15SecurityNorthRegulargreen
16AccountingNorthRegularblue
17SecurityNorthRegularblue
18AccountingNorthRegularblue
19

<colgroup><col style="width: 25pxpx"><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</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,215,488
Messages
6,125,092
Members
449,206
Latest member
ralemanygarcia

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