🔍 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
- 1QUERY uses SQL-like syntax to filter/sort spreadsheet data.
- 2Specify the data range (A1:D100).
- 3Write the query: SELECT columns, WHERE conditions, ORDER BY sort.
- 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
VLOOKUP — Look up a value in a table by matching the first columnLookupINDEX/MATCH — Flexible lookup - more powerful than VLOOKUPLookupXLOOKUP — Modern replacement for VLOOKUP (Excel 365)LookupFILTER — Return rows matching criteria (dynamic filter)Lookup
Need a formula that's not here?
Generate custom formula →