fx N/AABCSKU-4821Widget A$24.99SKU-7293Gadget B$89.50SKU-1056Tool C$12.75
🔍 Lookup

QUERY Formula for Lookup

SQL-like queries on spreadsheet data (Google Sheets). Copy-paste ready for Excel, Google Sheets, and Airtable.

=QUERY(A1:D100,"SELECT A,C WHERE B>50 ORDER BY C DESC")
When you need this: When you need to show only product names (column A) and prices (column C) for items with sales > 50 (column B), sorted by price high-to-low.

How it works

  1. 1QUERY uses SQL-like syntax to filter/sort spreadsheet data.
  2. 2Specify the data range (A1:D100).
  3. 3Write the query: SELECT columns, WHERE conditions, ORDER BY sort.
  4. 4Returns only matching rows and selected columns.

Variations

Query with GROUP BY
=QUERY(A1:D100,"SELECT A,SUM(C) WHERE B>0 GROUP BY A")
Query with LIMIT
=QUERY(A1:D100,"SELECT A,C WHERE B>50 ORDER BY C DESC LIMIT 10")

Related Formulas

Need a formula that's not here?

Generate custom formula →