How do you change the default aggregate name created in Google Sheets when using the
To change the header label of an aggregate column from a
LABEL aggregate_column 'YOUR LABEL'
For example, if you had the following
formula in your Google Sheet and you wanted to change the default label of
then this is how this would look, here’s the original
=QUERY(Data!A:C, "SELECT SUM(B), SUM(C)")
Here’s how this formula looks by default as seen in the
Custom Aggregate Column Name
To create your own label on the aggregate column, use the
syntax in your
statement. If you wanted to add a more precise name to the
column header, all you would need do is append the following syntax to your
=QUERY(Data!A:C, "SELECT SUM(B), SUM(C) LABEL SUM(B) 'Total Sold', SUM(C) 'Total Sales'")
The main thing to emphasise when appending a label, just as it is here with
LABEL SUM(B) 'Total Sold'
that I’d like to emphasise, is that the aggregate column defined after the word
needs to be written
exactly the same
as it is in the
As you can see with the example, the
has one aggregate column defined as
therefore, this needs to be used in the
area if you wanted to rename this column header.
This is true even if the aggregate function is a formula containing multiple aggregates, for example, if you had an aggregate column like
SUM(B) - SUM(C)
to create a custom label for that aggregate, you would need to append the same in the label area, like
LABEL SUM(B) - SUM(C) 'Differences'
Here’s how the resulting aggregate result now looks on the spreadsheet in sheet
when you name your aggregate columns using the
Aggregate Names Not Changing
If you are experiencing problems with using the
statement when using the
function check each of the following:
is using the correct aggregate function(s) in the
area of your statement. Remember, the syntax needs to be
LABEL aggregate_column 'Custom Name'
needs to match the aggregate column in the
2. The name of the aggregate label is wrapped in single quotes.
3. The position of
is towards the end of your statement.
I have found one of these to be the reason why a name for an aggregate column did not work.
Aggregating your data in a spreadsheet can make finding data a lot easier, however, the output of an aggregate result may look a little ugly.
To change the default name produced by Google Sheets from an aggregate column use the
syntax in your
statement and ensure the
matches the function used in the
section of your