QUERY

Formulas / QUERY
To pull data from a data table into the sheet.
QUERY(tableAndRows, columns)
  • tableAndRows - The data table name or data table row.
  • columns - [Optional] The field name.

Examples

  • =QUERY(A1:C10, "SELECT A, B WHERE C > 100", 1)

    In this example, the QUERY function is used to retrieve data from the range A1:C10. The SQL-like query selects columns A and B where the corresponding value in column C is greater than 100. The third argument, 1, specifies that the data range includes a header row. The result is a filtered list of data from columns A and B where the condition in column C is met.

  • =QUERY(A1:D20, "SELECT A, SUM(D) GROUP BY A LABEL SUM(D) 'Total Sales'", 1)

    In this example, the QUERY function is used to retrieve and summarize data from the range A1:D20. The SQL-like query selects column A and calculates the sum of column D, grouping the results by the values in column A. The "LABEL" clause is used to rename the header of the summed column to "Total Sales." The third argument, 1, specifies that the data range includes a header row. The result is a summary table showing the total sales for each unique value in column A.

Summary

The QUERY function is a powerful tool for working with data in Google Sheets and can be implemented in Sourcetable. It allows for filtering, aggregating, and pivoting data for more efficient data analysis.

  • QUERY references data with structured referencing


Frequently Asked Questions

What is the QUERY function?
The QUERY function is a function that can be used to get data from data tables in a worksheet, manipulate, analyze, and pivoting data.

Make Better Decisions
With Data

Analyze data, automate reports and create live dashboards
for all your business applications, without code. Get unlimited access free for 14 days.