Skip to main content

Calculate the number of unique values in a spreadsheet column

Learn how to use the Query function to count the number of occurrences of each unique value in a spreadsheet before connecting to Geckoboard

Updated over a week ago

When you have a column containing different string values, you can use the Query function to calculate the number of unique values.

The query sums the number of unique values in column A and then generates a grouped list of totals in descending order. Here's an example query you can use:

=QUERY(A2:A,"select A, count (A) where A <> '' group by A order by count (A) desc")

Visualize sales by items sold

We can then visualize this data and track sales by item sold either as a leaderboard or bar chart.

Did this answer your question?