QUERY Formula Generator

QUERY is Google Sheets' most powerful function. It lets you use SQL-like syntax to select, filter, sort, group, and aggregate data — all in a single formula.

Syntax=QUERY(data, query_string, [headers])
Try it — generate a QUERY formula

Examples

Select and filter

=QUERY(A1:D100, "SELECT A, D WHERE B = 'West' ORDER BY D DESC", 1)

Returns columns A and D where column B is "West", sorted by D descending. 1 indicates one header row.

Group and aggregate

=QUERY(A1:D100, "SELECT B, SUM(D) GROUP BY B", 1)

Groups by column B (region) and sums column D (sales) for each group.

Tips

Related Formulas

FILTER

FILTER returns rows from a range that meet specified conditions. It's like AutoF...

SUMIFS

SUMIFS adds up values that meet multiple criteria. It's essential for financial ...

ARRAYFORMULA

ARRAYFORMULA applies a formula to an entire column or range at once, eliminating...

Need a different formula?

Describe any formula in plain English and FormulaPad will generate it.

Try FormulaPad Free