CountIf & Unique Values

tangerine7199

New Member
Joined
Oct 13, 2016
Messages
5
Good Morning

I need to do a count of people in a school (A) based on their value in columnB. Duplicate people are OK. Duplicate people in a school is not OK. I would want only the count of Unique ID-Schools if their value in B is 1

Example

A B
[TABLE="width: 146"]
<colgroup><col><col></colgroup><tbody>[TR]
[TD]ID-School[/TD]
[TD]First Year[/TD]
[/TR]
[TR]
[TD]123-school1[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD]555-school2[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]999-school3[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD]123-school1[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD]999-school3[/TD]
[TD="align: right"]2[/TD]
[/TR]
[TR]
[TD]555-school2[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]



any help will be appreciated
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
Try the following formula, which needs to be confirmed with CONTROL+SHIFT+ENTER...

=SUM(IF(FREQUENCY(IF($B$2:$B$7=D2,IF(LEN($A$2:$A$7)>0,MATCH("~"&$A$2:$A$7,$A$2:$A$7&"",0))),ROW($A$2:$A$7)-ROW($A$2)+1)>0,1))

...where D2 contains the value of interest, such as 1.

Hope this helps!
 
Upvote 0
Thank you so much! but i think i need to clarify:

ID-School is column A
First Year is column B (and that's where the one is)

does this change the formula?
 
Upvote 0
No need to change the formula, other than to adjust the ranges to include all your data.
 
Upvote 0
You're very welcome. Glad I could help.

I'm not sure what you mean. Can you please elaborate, and provide the actual results you expect based on your example?
 
Upvote 0
Your formula gave me a total of unique ID AND School. To go a little further, how could i get a count of unique id's by school? Does this image help?

open
 
Upvote 0
Based on the data you provide in your image, what are the actual results you expect for School1, School2, and School3?
 
Upvote 0

Forum statistics

Threads
1,223,231
Messages
6,170,884
Members
452,364
Latest member
springate

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