Google-sheets – How to display data in QUERY formula cell

google sheetsgoogle-sheets-query

I have an empty cell where my QUERY formula is written, and I would like to display data in that cell.

Empty cell where query formula lives

I was hoping to display either the first value of the results in that cell, ie, 'Direct' and '6851' beside it…

Or, it could be a header I define, eg. 'Channel Grouping'.

Can I do either, or both?

Please see link to live doc in first comment with my attempt. I've been looking around for a way to control this, but so far haven't found my answer.

Best Answer

Found it! You can add multiple headers (labels) separated with commas like so:

=QUERY(A3:F, "select B, sum(C) where F = 1 group by B label sum(C) 'Sessions', B 'Channel Grouping'",0)

Excerpt:

label sum(C) 'Sessions', B 'Channel Grouping'