SELECT & WHERE: Filter Rows with Flags and COUNTIFS
All lessons
- SELECT & WHERE: Filter Rows with Flags and COUNTIFSFree
- ORDER BY & LIMIT: Rank, Top 3 with LARGE and INDEX/MATCHFree
- GROUP BY with COUNT, SUM & AVG: COUNTIFS, SUMIFS, AVERAGEIFS Tables Pro
- HAVING: Filter Groups on Their Aggregates Pro
- INNER JOIN: XLOOKUP and the #N/A Rows a Join Drops Pro
- LEFT JOIN & NULLs: IFNA, 'Unknown' and Unmatched Rows Pro
- DISTINCT & Duplicates: First-Occurrence COUNTIF Pro
- CASE WHEN & Date Functions: IFS Buckets and YEAR/MONTH Grouping Pro
You are not signed in — the lab works, but your progress is not saved. Start free
Read first
The SQL
-- rows: which orders match?
SELECT order_id, amount
FROM orders
WHERE region = 'North'
AND amount >= 100;
-- one number: how many?
SELECT COUNT(*) FROM orders
WHERE region = 'North' AND amount >= 100;
SELECT SUM(amount) FROM orders WHERE status = 'Shipped';
SELECT SUM(amount) FROM orders
WHERE category IN ('Gear', 'Subscription');The spreadsheet equivalent
- WHERE a AND b → a flag
=IF(AND(…),1,0)or the criteria pairs of COUNTIFS / SUMIFS - COUNT(*) → COUNTIFS(range1, crit1, range2, crit2)
- SUM(amount) WHERE … → SUMIFS(sum range, criteria range, criterion)
- >=, <>, LIKE 'B%' → ">="&G20, "<>Shipped", "B*" as criteria text
- IN (…) → one SUMIF/COUNTIF per value, added together
In Excel you would often use AutoFilter for the rows. Formulas are better for reports: they update when the data changes.
Loading the spreadsheet…