Countifs without duplicate

jyroxxor

New Member
Joined
Feb 26, 2018
Messages
11
Help needed!
Data below shown John has 3 outlets in Jan. What would be the formula for me to put in C3 to get 3? If I change the manager to Smith, will the number change automatically as well? Thanks!

ABCD
1 MonthJan
2 ManagerJohn
3 No of Shop3(Exclude duplicate)
4
5MonthManagerShopStaff
6JanJohnAAAA
7JanJohnAAAB
8JanJohnBBBC
9JanJohnCCCD
10JanJohnAAAE
11JanSmithYYYF
12JanSmithZZZG
13JanSmithXXXH
14JanSmithXXXI
15JanSmithWWWJ
16JanSmithZZZK
17JanSmithYYYL
18JanSmithWWWM
19FebJohnAAAN
20FebJohnAAAO
21FebJohnAAAP
22FebJohnAAAQ
23FebJohnAAAR
24FebJohnAAAS

<colgroup><col><col><col><col><col></colgroup><tbody>
</tbody>
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
Welcome to the MrExcel board!

See if this does what you want. It is an array formula so should be entered without the {} but confirmed with Ctrl+Shift+Enter, not just Enter. If confirmed correctly, Excel will insert the {}.

Excel Workbook
ABCD
1MonthJan
2ManagerJohn
3No of Shop3
4
5MonthManagerShopStaff
6JanJohnAAAA
7JanJohnAAAB
8JanJohnBBBC
9JanJohnCCCD
10JanJohnAAAE
11JanSmithYYYF
12JanSmithZZZG
13JanSmithXXXH
14JanSmithXXXI
15JanSmithWWWJ
16JanSmithZZZK
17JanSmithYYYL
18JanSmithWWWM
19FebJohnAAAN
20FebJohnAAAO
21FebJohnAAAP
22FebJohnAAAQ
23FebJohnAAAR
24FebJohnAAAS
Count
 
Upvote 0
Hi Peter,

Could I ask: is there a reason for the &"|"& instead of just &

e.g. C1 &"|"& C2 instead of just C1 & C2 ?
 
Upvote 0
Hi Peter,

Could I ask: is there a reason for the &"|"& instead of just &

e.g. C1 &"|"& C2 instead of just C1 & C2 ?
It is just a safety measure. As a general example, look at columns A:B below. Without the delimiter (column C formula) all rows would appear to be the same. With the delimiter (column D formula) they are clearly all different.


Book1
ABCD
1aabbaabbaa|bb
2aabbaabba|abb
3aabbaabb|aabb
Sheet5
Cell Formulas
RangeFormula
C1=A1&B1
D1=A1&"|"&B1
 
Upvote 0
Welcome to the MrExcel board!

See if this does what you want. It is an array formula so should be entered without the {} but confirmed with Ctrl+Shift+Enter, not just Enter. If confirmed correctly, Excel will insert the {}.

Count

ABCD
1 MonthJan
2 ManagerJohn
3 No of Shop3
4
5MonthManagerShopStaff
6JanJohnAAAA
7JanJohnAAAB
8JanJohnBBBC
9JanJohnCCCD
10JanJohnAAAE
11JanSmithYYYF
12JanSmithZZZG
13JanSmithXXXH
14JanSmithXXXI
15JanSmithWWWJ
16JanSmithZZZK
17JanSmithYYYL
18JanSmithWWWM
19FebJohnAAAN
20FebJohnAAAO
21FebJohnAAAP
22FebJohnAAAQ
23FebJohnAAAR
24FebJohnAAAS

<colgroup><col style="font-weight:bold; width:30px; "><col style="width:55px;"><col style="width:83px;"><col style="width:58px;"><col style="width:54px;"></colgroup><tbody>
</tbody>

Spreadsheet Formulas
CellFormula
C3{=COUNT(1/(MATCH(C1&"|"&C2&"|"&C6:C24,A6:A24&"|"&B6:B24&"|"&C6:C24,0)=ROW(C6:C24)-ROW(C6)+1))}

<tbody>
</tbody>
Formula Array:
Produce enclosing
{ } by entering
formula with CTRL+SHIFT+ENTER!

<tbody>
</tbody>


Excel tables to the web >> Excel Jeanie HTML 4

Thanks Peter! It's the outcome that I want! Although I do not understand the logic behind... haha
 
Upvote 0
Hihi!

What would be the formula if there are 2 out of 3 shops are achieve more than 50% as shown below. Million thanks!

MonthJan
ManagerJohn
No of Shop3
No of Shop >50%2
MonthManagerShopShop %Staff
JanJohnAAA51%A
JanJohnAAA51%B
JanJohnBBB30%C
JanJohnCCC60%D
JanJohnAAA51%E
JanSmithYYY30%F
JanSmithZZZ80%G
JanSmithXXX20%H
JanSmithXXX20%I
JanSmithWWW60%J
JanSmithZZZ80%K
JanSmithYYY30%L
JanSmithWWW60%M
FebJohnAAA90%N
FebJohnAAA90%O
FebJohnAAA90%P
FebJohnBBB30%Q
FebJohnCCC58%R
FebJohnAAA90%S

<colgroup><col><col><col><col><col></colgroup><tbody>
</tbody>
 
Upvote 0
Best not to fully quote long posts as it makes the thread harder to read/navigate and just occupies storage space needlessly.
If you want to quote, quote small, relevant parts only, as I have done below.

What would be the formula if there are 2 out of 3 shops are achieve more than 50%
Try

Excel Workbook
ABCD
1MonthJan
2ManagerSmith
3No of Shop
4No of Shop >50%2
5
6MonthManagerShopShop %
7JanJohnAAA51%
8JanJohnAAA51%
9JanJohnBBB30%
10JanJohnCCC60%
11JanJohnAAA51%
12JanSmithYYY30%
13JanSmithZZZ80%
14JanSmithXXX20%
15JanSmithXXX20%
16JanSmithWWW60%
17JanSmithZZZ80%
18JanSmithYYY30%
19JanSmithWWW60%
20FebJohnAAA90%
21FebJohnAAA90%
22FebJohnAAA90%
23FebJohnBBB30%
24FebJohnCCC58%
25FebJohnAAA90%
Count 2
 
Upvote 0
Thanks Peter! You are the best!
You are welcome.

BTW, I have removed the long quote from your last post. Perhaps you missed the first part of my earlier post:

Best not to fully quote long posts as it makes the thread harder to read/navigate and just occupies storage space needlessly.
If you want to quote, quote small, relevant parts only ...
 
Upvote 0

Forum statistics

Threads
1,214,983
Messages
6,122,598
Members
449,089
Latest member
Motoracer88

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