Minor issue with Query functions

Fairly new to using Query functions. One thing I’m running into is that I’m trying to perform a COUNT on a range of cells. For some reason, the code below inserts the text “count” into the last column of my sheet and I don’t know how to avoid it.

=SORT(QUERY('Latest Submissions'!C:M,"SELECT C, count(F) where F is not null group by C",0),2,TRUE)

The query does what I need it to do, but the result is the following:
image

This is just the label for your query function, pretty ugly aren’t they!

If you add in:
LABEL C ‘Game Date’, count(F) ‘Number of Spares’

After
group by C

that should give you the answer. Alternatively, you can just leave the spaces between the ’ ’ empty (like that) and keep your hard-coded titles. It’s up to you, you just need the LABEL clause in there.

Edit: Actually, given your syntax on the sort, if you put titles in it’ll sort them too. You can either choose the second option (leaving them blank) or remove the sort and add in “ORDER BY count(F) ASC” so you have:

=QUERY(‘Latest Submissions’!C:M,"SELECT C, count(F) where F is not null group by C ORDER BY count(F) ASC LABEL C ‘Game Date’, count(F) ‘Number of Spares’ ",0)

2 Likes