Work & productivity / QUICK REFERENCE
Google Sheets formulas: QUERY, FILTER and arrays
Use Google Sheets formulas to filter, sort, summarize, import and transform dynamic ranges.
Filter and extract rows
- Filter by threshold
=FILTER(A2:D100,C2:C100>100)- Filter by two conditions
=FILTER(A2:D100,B2:B100="Open",C2:C100>100)Both boolean filter vectors must align to input rows. [2][5]
- Filter by one of two values
=FILTER(A2:D100,(B2:B100="Open")+(B2:B100="Hold"))- Filter with fallback
=IFNA(FILTER(A2:D100,C2:C100>100),"No matches")FILTER uses #N/A when no results satisfy the criteria. [2][5]
QUERY language tasks
- Select two columns
=QUERY(A1:D100,"select A, C",1)Selects the first and third input columns. [1]
- Filter numeric rows
=QUERY(A1:D100,"select A, C where C > 100",1)A Sheets query string uses Google Visualization syntax. [1]
- Filter text equality
=QUERY(A1:D100,"select A where B = 'Open'",1)String values are quoted inside the query text. [1]
- Sort one column
=QUERY(A1:D100,"select A, C order by C desc",1)Sorts in descending C-column order. [1]
- Limit result size
=QUERY(A1:D100,"select A, B limit 10",1)Returns no more than ten data rows. [1]
- Summarize values
=QUERY(A1:D100,"select B, sum(C) group by B",1)Groups categories and sums numeric C values. [1]
- Average by category
=QUERY(A1:D100,"select B, avg(C) group by B",1)Computes average numeric values per category. [1]
- Count category rows
=QUERY(A1:D100,"select B, count(A) group by B",1)Counts nonnull A values for each B group. [1]
- Set output label
=QUERY(A1:D100,"select B, sum(C) group by B label sum(C) 'Total'",1)Overrides the computed column's display heading. [1]
- Choose matching category
=QUERY(A1:D100,"select A where B = '"&F2&"'",1)Inserts a trusted lookup value; quote escaping matters for arbitrary text. [1]
- Skip leading results
=QUERY(A1:D100,"select A offset 5",1)Starts output after the first five matching data rows. [1]
- Pivot grouped data
=QUERY(A1:D100,"select B, sum(C) group by B pivot D",1)Produces columns from the distinct D values when query types permit. [1]
Array expressions and text
- Conditional row labels
=ARRAYFORMULA(IF(A2:A100="","",IF(C2:C100>100,"High","Low")))Creates row-wise labels while suppressing blank keys. [3][5]
- Increment a numeric column
=ARRAYFORMULA(C2:C100+1)Computes a new array without dragging a formula down. [3][5]
- Count only positive
=COUNTIF(C2:C100,">0")Aggregates positive cells; it does not return an array. [3][5]
Import, permission and errors
- Import another sheet
=IMPORTRANGE(F2,"Data!A1:D100")F2 must contain an authorized source spreadsheet URL. [4][5]
- Use an external named range
=IMPORTRANGE(F2,"Sales_total")A named range in another sheet can be the import target. [4][5]
- Import a single column
=IMPORTRANGE(F2,"Data!B2:B100")Restricting the imported range reduces transferred data. [4][5]
- Filter imported data
=QUERY(IMPORTRANGE(F2,"Data!A1:C100"),"select Col1,Col3 where Col3>100",1)- Test import permissions
=IMPORTRANGE(F2,"Data!A1")Initial access usually needs explicit permission approval. [4][5]
Reserved placement, separate from reference controls. No ad network is active.
No matching entry. Try a shorter word or clear the search to see the complete sheet.
Sources
cheatsheetatlas.com/sheets/google-sheets-formulas/ · Updated 2026-10-20 · Google Sheets · current