Skip to content
Advertisement

SELECT DISTINCT sum in google sheet

i’ve a sheet like this:

Month(Col11) Team (Col2)
03 luna
03 luna
04 pippo
04 gigi
04 luna
04 gigi
04 pippo
04 luna
04 luna
04 pippo
04 pippo
04 grisbi
04 grisbi
05 luna
05 luna
05 pippo
05 pippo
05 grisbi
05 grisbi

i need the sum of unique of each month, a result like this:

Month(Col11) Sum of unique (Col2)
03 1
04 4
05 3

i try with: =QUERY(database_tornei!A:K;”select Col11,count(Col2) group by Col11″) But i’ve the sum of all Teams in Col2. Don’t know how to use dinstinct in query 🙁

Advertisement

Answer

You can wrap your existing query() in another query() like this:

=query( query(A1:K, "select K, A, count(K) where K is not null group by K, A", 1), "select Col1, count(Col3) group by Col1", 1 )

This will get the count of uniques per month.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement