• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Count if functions

poolboy

New Member
I have an excel spreadsheet with duplicate names in one column and their class year in another column, how do i use a formula to count them only once, and another formula to count by class year.
 
Hi, poolboy!


You can use Data tab, Data Tools group, Remove Duplicates button.

Asuming your data is in A and B columns, just select them, press the related button, et voila! No more duplicates.


Then in C1 type =COUNT(B:B) for first question.

For the second question, from D1 down type all the class years, and in E1 type =COUNTIF(B:B,D1) and copy down as needed.


If you want to preserve the original A&B columns, just copy them before to C&D, and adjust the two formulas.


Regards!
 
Hi, poolboy!

Could you please upload the file? Check 2nd green sticky post at this forums main page if necessary.

Regards!
 
A PivotTable would be the fastest way to do this, as you could create the table, then alternatively throw Names or Class into the Data_Field area and do a count. Boom, done.


Via formula, you could do something like:

=IF(COUNTIF(A$2:A2,A2)=1,A2,"DUPLICATE")

To get a unique list (change columns if you want by class), and then to get the count you just do:

=COUNTIF(C:C,"<>DUPLICATE")
 
Back
Top