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
4 Answers
If it doesn't have to be updated dynamically, you might also copy the cells and run something like pbpaste | sort | uniq | wc -l.
- 105,117
-
-
5@CousinCocaine you need
sortbecauseuniqonly detects repeated lines immediately following each other, not repeated lines anywhere in the input stream. Seeuniqman page. – Fabian Tamp Nov 20 '15 at 04:24 -
2
-
3
-
This one is always better than clunky gui, thanks for the reminder bro! – valignatev Jun 01 '17 at 21:09
-
This is a clean solution. It's obscene that there's no baked-in function for doing this. – ryantuck Mar 09 '21 at 23:53
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.
-
6This 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
You can use Numbers' (new) Pivot Table tool to summarize data
To get count of unique value:
- Make sure your table is selected
- On toolbar, click
Pivot Table - In sidebar, select your column under
Fields - In sidebar, under
Values, select or change "Summarize by" toCount (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
- 221
-
1This is the best solution, I think. Step 4 was a little tricky — what I ended up doing was dragging the green lozenge under
Rowsover toValuesand then I could click the(i)and change toCount (Unique). – Matt Sephton Mar 31 '23 at 12:41
I just select the column and copy, go to Terminal, type wc(return), paste in the copy, type Ctrl-D, and read the count.
- 4,869
- 7
- 44
- 77