Ask Different is a question and answer site for power users of Apple hardware and software. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'd like to count the occurrence of unique items found in one column of about 120 items. I can't find a way to do this in

share|improve this question
Currently, if I do this calculation in the footer row, or another table, they both show up as "0" – Graphic Agenda Jul 5 '12 at 23:05
Shows up as "0" because I'm not sure how to use the Count function really well. – Graphic Agenda Jul 7 '12 at 23:28
up vote 8 down vote accepted

Here is a clever solution posted in an apple discussions thread.

You basically create another column, and use the formula =IF(COUNTIF(A$1:A1, A2)=0,1,""). This will display a one for the first occurrence of each unique item. You then simply sum the whole column and you get your count.

share|improve this answer
Works great! Thank you. – Graphic Agenda Jul 7 '12 at 23:27
Your Welcome! :) – kevin9794 Jul 12 '12 at 18:56

If it doesn't have to be updated dynamically, you might also copy the cells and run something like pbpaste | sort | uniq | wc -l.

share|improve this answer
Copy the column and run pbpaste| sort | uniq -c in a terminal. – vrypan Feb 2 '15 at 8:24
why do you need sort? – CousinCocaine Apr 13 '15 at 17:59
@CousinCocaine you need sort because uniq only detects repeated lines immediately following each other, not repeated lines anywhere in the input stream. See uniq man page. – Fabian Tamp Nov 20 '15 at 4:24
You can also use sort -u instead of sort | uniq – damiankloip Feb 23 at 15:43

protected by bmike Feb 23 at 17:03

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.