Home » Google Sheets Query: How to Use the Label Clause

Google Sheets Query: How to Use the Label Clause

by Tutor Aspire

You can use the label clause in a Google Sheets query to create specific labels for the results of certain columns.

You can use the following syntax to create a specific label for one column within a query:

=QUERY(A1:C13, "select * label A 'Column A'")

In this example, we select all columns in the range A1:C13 and we label column A as ‘Column A’ in the resulting output.

You can also use the following syntax to create specific labels for multiple columns within a query:

=QUERY(A1:C13, "select * label A 'A Column', B 'B Column'") 

The following examples show how to use these formulas in practice.

Example 1: Use Label Clause with One Column

We can use the following formula to select the Team, Points, and Rebounds columns, then label the ‘Team’ column as ‘Team Name’ in the output:

label clause in Google Sheets

Notice that the ‘Team’ column has been renamed, but the ‘Points’ and ‘Rebounds’ columns retained their original names.

Example 2: Use Label Clause with Multiple Columns

We can use the following formula to select the Team, Points, and Rebounds columns, then label the ‘Team’ column as ‘Team Name’ and ‘Points’ column as ‘Points Scored’ in the output:

In this example, we used the label clause to rename two columns in the output but we can use this exact same syntax to rename any number of columns that we’d like.

Additional Resources

The following tutorials explain how to perform other common operations with Google Sheets queries:

Google Sheets: How to Query From Another Sheet
Google Sheets Query: Select Rows that Contain String
Google Sheets Query: How to Use Group By

You may also like