Count multiple labels for one record once

rhmkrmi

Active Member
Joined
Aug 17, 2012
Messages
341
Office Version
  1. 365
Platform
  1. Windows
Hello,

I have a large spreadsheet where I get multiple rows for the same person with repeated labels and I need to count the label only once for each person.
In this example below, I need to count 5 labels for John and 4 labels for Mary. At the moment, I get a total of 13 for each person which is incorrect.

PersonLabel
JohnFinance
JohnFinance
JohnOperations
JohnCommercial
JohnCommercial
JohnCommercial
JohnCommercial
JohnManagement
JohnManagement
JohnManagement
JohnProcurement
JohnProcurement
JohnProcurement
MaryMarketing
MaryMarketing
MaryMarketing
MaryMarketing
MaryMarketing
MaryOperations
MaryOperations
MaryOperations
MaryOperations
MaryManagement
MaryManagement
MaryProcurement
MaryProcurement

Is there a formula that I can use?

Thanks.
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Perhaps this?
Book1
ABCDE
1PersonLabel
2JohnFinanceJohn5
3JohnFinanceMary4
4JohnOperations
5JohnCommercial
6JohnCommercial
7JohnCommercial
8JohnCommercial
9JohnManagement
10JohnManagement
11JohnManagement
12JohnProcurement
13JohnProcurement
14JohnProcurement
15MaryMarketing
16MaryMarketing
17MaryMarketing
18MaryMarketing
19MaryMarketing
20MaryOperations
21MaryOperations
22MaryOperations
23MaryOperations
24MaryManagement
25MaryManagement
26MaryProcurement
27MaryProcurement
Sheet1
Cell Formulas
RangeFormula
E2E2=SUM(IF(FREQUENCY(IF($A$2:$A$27=D2,MATCH($B$2:$B$27,$B$2:$B$27,0)),ROW($B$2:$B$27)-ROW(B2)+1),1))
E3E3=SUM(IF(FREQUENCY(IF($A$2:$A$27=D3,MATCH($B$2:$B$27,$B$2:$B$27,0)),ROW($B$2:$B$27)-ROW(B2)+1),1))
 
Upvote 0
Perhaps this?
Book1
ABCDE
1PersonLabel
2JohnFinanceJohn5
3JohnFinanceMary4
4JohnOperations
5JohnCommercial
6JohnCommercial
7JohnCommercial
8JohnCommercial
9JohnManagement
10JohnManagement
11JohnManagement
12JohnProcurement
13JohnProcurement
14JohnProcurement
15MaryMarketing
16MaryMarketing
17MaryMarketing
18MaryMarketing
19MaryMarketing
20MaryOperations
21MaryOperations
22MaryOperations
23MaryOperations
24MaryManagement
25MaryManagement
26MaryProcurement
27MaryProcurement
Sheet1
Cell Formulas
RangeFormula
E2E2=SUM(IF(FREQUENCY(IF($A$2:$A$27=D2,MATCH($B$2:$B$27,$B$2:$B$27,0)),ROW($B$2:$B$27)-ROW(B2)+1),1))
E3E3=SUM(IF(FREQUENCY(IF($A$2:$A$27=D3,MATCH($B$2:$B$27,$B$2:$B$27,0)),ROW($B$2:$B$27)-ROW(B2)+1),1))
Thank you.

I actually need a formula in column C of your example above that can give me 0 or 1:

PersonLabelCount
JohnFinance
1​
JohnCommercial
1​
JohnOperations
1​
JohnManagement
1​
JohnCommercial
0​
JohnFinance
0​
JohnCommercial
0​
JohnProcurement
1​
JohnCommercial
0​
JohnManagement
0​
JohnProcurement
0​
JohnProcurement
0​
JohnFinance
0​
MaryOperations
1​
MaryOperations
0​
MaryMarketing
1​
MaryFinance
1​
MaryMarketing
0​
MaryOperations
0​
MaryManagement
1​
MaryManagement
0​
MaryOperations
0​
MaryManagement
0​
MaryManagement
0​
MaryProcurement
1​
MaryManagement
0​

Thanks.
 
Upvote 0
Book1
ABC
1PersonLabelCount
2JohnFinance1
3JohnCommercial1
4JohnOperations1
5JohnManagement1
6JohnCommercial0
7JohnFinance0
8JohnCommercial0
9JohnProcurement1
10JohnCommercial0
11JohnManagement0
12JohnProcurement0
13JohnProcurement0
14JohnFinance0
15MaryOperations1
16MaryOperations0
17MaryMarketing1
18MaryFinance1
19MaryMarketing0
20MaryOperations0
21MaryManagement1
22MaryManagement0
23MaryOperations0
24MaryManagement0
25MaryManagement0
26MaryProcurement1
27MaryManagement0
Sheet3
Cell Formulas
RangeFormula
C2:C27C2=(COUNTIFS($A$2:$A2,$A2,$B$2:$B2,$B2)=1)+0
 
Upvote 0
Solution
Book1
ABC
1PersonLabelCount
2JohnFinance1
3JohnCommercial1
4JohnOperations1
5JohnManagement1
6JohnCommercial0
7JohnFinance0
8JohnCommercial0
9JohnProcurement1
10JohnCommercial0
11JohnManagement0
12JohnProcurement0
13JohnProcurement0
14JohnFinance0
15MaryOperations1
16MaryOperations0
17MaryMarketing1
18MaryFinance1
19MaryMarketing0
20MaryOperations0
21MaryManagement1
22MaryManagement0
23MaryOperations0
24MaryManagement0
25MaryManagement0
26MaryProcurement1
27MaryManagement0
Sheet3
Cell Formulas
RangeFormula
C2:C27C2=(COUNTIFS($A$2:$A2,$A2,$B$2:$B2,$B2)=1)+0
Excellent.
Thank you so much.
It is perfect.
 
Upvote 0
Excellent.
Thank you so much.
It is perfect.
The marked solution has been changed accordingly. In your future questions, please mark the post as the solution that actually answered your question, instead of your feedback message as it will help future readers. No further action is required for this thread.
 
Upvote 0

Forum statistics

Threads
1,214,936
Messages
6,122,340
Members
449,079
Latest member
rocketslinger

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