26

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 Numbers.app

Greg K.
  • 453

4 Answers4

25

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

Lri
  • 105,117
17

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.

Daniel
  • 34,803
kevin9794
  • 4,300
  • 6
    This is extremely slow when there's lots of data. If that's the case, you can import your data into Google Spreadsheets and use =COUNTUNIQUE(A:A) – Eugene Kulabuhov May 31 '17 at 14:04
6

You can use Numbers' (new) Pivot Table tool to summarize data

To get count of unique value:

  1. Make sure your table is selected
  2. On toolbar, click Pivot Table
  3. In sidebar, select your column under Fields
  4. In sidebar, under Values, select or change "Summarize by" to Count (Unique). You may need to click the little (i) icon.

You will see the answer in the created pivot table

You can summarize by groups ("facet") by selecting additional Fields

You can add more results to the same table, by dragging Fields as new Values

Paul
  • 221
  • 1
    This is the best solution, I think. Step 4 was a little tricky — what I ended up doing was dragging the green lozenge under Rows over to Values and then I could click the (i) and change to Count (Unique). – Matt Sephton Mar 31 '23 at 12:41
0

I just select the column and copy, go to Terminal, type wc(return), paste in the copy, type Ctrl-D, and read the count.

WGroleau
  • 4,869
  • 7
  • 44
  • 77