Beginner 6 min read

QUERY LABEL in Google Sheets: Rename Headers

Learn how to use QUERY LABEL in Google Sheets to rename column headers in your output. Syntax, step-by-step examples, and common mistakes.

SB

Sheets Bootcamp

March 8, 2026 · Updated September 7, 2026

The QUERY LABEL clause in Google Sheets renames column headers in the output without changing your source data. When a QUERY formula returns results, the headers default to your original column names or, worse, auto-generated labels like “sum Revenue.” LABEL gives you control over what those headers say. We’ll cover the syntax, walk through renaming single and multiple columns, and show how LABEL pairs with GROUP BY and FORMAT.

In This Guide

LABEL Syntax

LABEL goes at the end of the query string, after all other clauses:

Formula
=QUERY(data, "SELECT columns ... LABEL column1 'New Name', column2 'New Name'")
PartDescriptionRequired
Column referenceThe column letter (A, B, C) or aggregate expression (SUM(F)) to renameYes
New nameThe replacement header text, wrapped in single quotesYes
Comma separatorSeparates multiple column-label pairsOnly for multiple labels

LABEL accepts any column referenced in your SELECT clause, including aggregate functions like SUM(F) or COUNT(D).

Important

New header names must be wrapped in single quotes inside the query string. LABEL B 'Sales Rep' works. LABEL B "Sales Rep" breaks because the double quotes conflict with the outer formula quotes.

Clause Order

QUERY clauses must follow this order: SELECT, WHERE, GROUP BY, PIVOT, ORDER BY, LIMIT, OFFSET, LABEL, FORMAT. LABEL always comes near the end. Placing it before ORDER BY or GROUP BY causes a parse error.

How to Use QUERY LABEL: Step-by-Step

We’ll use the sales records table from the QUERY guide. The data is in A1:G19 with 18 transactions.

Sample Data

ABCDEFG
1DateSalespersonRegionProductUnitsRevenueCommission
21/5/2026Sherlock HolmesBaker StreetListening Device12$239.88$24.00
31/7/2026Irene AdlerScotland YardForensic Chemistry Set8$360.00$36.00
41/8/2026Inspector LestradeBaker StreetPocket Watch15$525.00$52.50
51/10/2026Sherlock HolmesBaker StreetField Binoculars5$325.00$32.50
61/12/2026Mycroft HolmesScotland YardCipher Decoder20$570.00$57.00

Sales records table with transaction data in Google Sheets

1

Review your data range

Your data is in A1:G19. Row 1 is the header row. Seven columns: Date (A), Salesperson (B), Region (C), Product (D), Units (E), Revenue (F), and Commission (G).

2

Write a QUERY with LABEL

Select an empty cell and enter:

Formula
=QUERY(A1:G19, "SELECT B, C, F LABEL B 'Sales Rep', C 'Territory', F 'Amount'")

This returns three columns with renamed headers: Sales Rep, Territory, and Amount. The data stays the same. Only the headers change.

QUERY LABEL renaming column headers in the output

3

Combine LABEL with GROUP BY

Enter:

Formula
=QUERY(A1:G19, "SELECT C, SUM(F) GROUP BY C LABEL C 'Region', SUM(F) 'Total Revenue'")

Without LABEL, the aggregated column header would read “sum Revenue.” With LABEL, it reads “Total Revenue.” The grouped column header changes from “Region” to “Region” (same in this case, but you can rename it to anything).

QUERY GROUP BY with LABEL showing clean headers

Tip

Always add LABEL when using GROUP BY. The default aggregate headers like “sum Revenue” or “count Product” are not presentation-ready. LABEL takes a few extra seconds and makes the output shareable.

LABEL Examples

Rename a Single Column

Formula
=QUERY(A1:G19, "SELECT B, F LABEL F 'Sales Amount'")

This returns Salesperson and Revenue columns. Only the Revenue header changes to “Sales Amount.” The Salesperson header stays as “Salesperson” because it is not referenced in LABEL.

Rename Multiple Columns

Formula
=QUERY(A1:G19, "SELECT A, B, D, F LABEL A 'Sale Date', B 'Sales Rep', D 'Item', F 'Revenue ($)'")

Each column gets its own label, separated by commas. The output headers read: Sale Date, Sales Rep, Item, Revenue ($). You can include special characters like parentheses and dollar signs in the label text.

QUERY LABEL renaming multiple columns with custom headers

LABEL with GROUP BY

Aggregate functions generate automatic headers that are not readable. LABEL fixes them:

Formula
=QUERY(A1:G19, "SELECT B, SUM(F), COUNT(D) GROUP BY B LABEL B 'Salesperson', SUM(F) 'Total Revenue', COUNT(D) 'Transactions'")

Without LABEL, the headers would be “Salesperson”, “sum Revenue”, and “count Product.” With LABEL, they read “Salesperson”, “Total Revenue”, and “Transactions.”

SalespersonTotal RevenueTransactions
Sherlock Holmes$1,189.734
Mycroft Holmes$1,410.864
Irene Adler$1,529.754
Inspector Lestrade$1,719.904
Note

When labeling an aggregate column, use the full aggregate expression as the reference. Write LABEL SUM(F) 'Total', not LABEL F 'Total'. The column reference in LABEL must match exactly what appears in SELECT.

LABEL with FORMAT

LABEL and FORMAT are separate clauses, but they work together. LABEL renames the header. FORMAT controls how the values display:

Formula
=QUERY(A1:G19, "SELECT C, SUM(F) GROUP BY C LABEL SUM(F) 'Total Revenue' FORMAT SUM(F) '$#,##0.00'")

This renames the header to “Total Revenue” and formats the values as currency with two decimal places. LABEL comes before FORMAT in the clause order.

Remove a Header with an Empty Label

You can set a header to blank by using an empty string:

Formula
=QUERY(A1:G19, "SELECT B, F LABEL B '', F ''")

Both headers become empty. This is useful when you are appending QUERY output below existing headers using curly-bracket array syntax.

Common Errors

Column reference does not match SELECT

If you write LABEL E 'Units' but column E is not in your SELECT clause, QUERY returns a parse error. Every column in LABEL must also appear in SELECT.

Using the wrong reference for aggregated columns

LABEL F 'Total' does not work when SELECT uses SUM(F). You must write LABEL SUM(F) 'Total'. The LABEL reference must match the SELECT expression exactly.

Missing single quotes around the new name

LABEL B Sales Rep breaks. The new name must be wrapped in single quotes: LABEL B 'Sales Rep'. Without quotes, QUERY interprets “Sales” and “Rep” as separate tokens and throws a parse error.

Placing LABEL before ORDER BY

LABEL must come after ORDER BY in the query string. SELECT C, SUM(F) GROUP BY C LABEL SUM(F) 'Total' ORDER BY SUM(F) DESC fails. Move LABEL to the end: SELECT C, SUM(F) GROUP BY C ORDER BY SUM(F) DESC LABEL SUM(F) 'Total'.

Tips and Best Practices

1. Always use LABEL with GROUP BY queries. Aggregate headers like “sum Revenue” and “avg Commission” are confusing. LABEL turns them into readable column names with no extra effort.

2. Match LABEL references to SELECT references exactly. If SELECT says SUM(F), LABEL must say SUM(F). If SELECT says B, LABEL must say B. Mismatches cause parse errors.

3. Use empty labels to hide headers when stacking QUERY results. When combining multiple QUERY outputs with {query1; query2}, set the second query’s headers to empty strings so they do not appear as data rows.

4. Keep label names short and descriptive. Headers appear at the top of the output table. Long names push column widths wider. Aim for 2-3 words per label.

5. Pair LABEL with FORMAT for polished reports. LABEL controls the header text. FORMAT controls value display. Together, they produce output that is ready to share without additional formatting.

Tip

You can rename a column to the same text as another column. QUERY does not require unique headers in the output. This can be useful when combining data from different sources.

Frequently Asked Questions

What does the LABEL clause do in Google Sheets QUERY?

LABEL renames column headers in the QUERY output. It does not change your source data. For example, LABEL B 'Sales Rep' changes the header of column B from “Salesperson” to “Sales Rep” in the result table.

How do you rename multiple columns with QUERY LABEL?

List each column and its new name separated by commas. For example, LABEL B 'Sales Rep', F 'Total Sales' renames both columns in a single clause. Each new name goes in single quotes.

Where does LABEL go in a QUERY string?

LABEL goes at the end of the query string, after SELECT, WHERE, GROUP BY, ORDER BY, and LIMIT. For example: SELECT B, F WHERE F > 300 ORDER BY F DESC LABEL B 'Rep', F 'Revenue'.

Can you use LABEL with GROUP BY in QUERY?

Yes. LABEL is especially useful with GROUP BY because aggregate functions create headers like “sum Revenue” or “count Product”. Use LABEL SUM(F) 'Total Revenue' to replace those default headers with readable names.

Frequently Asked Questions

Next Steps

Continue learning with these related tutorials: