Premium Google Sheets drill · QUERY
QUERY the top two products
Practice Google Sheets QUERY limit after order by so only the two highest unit counts are returned.
limit cuts the result after sorting. The header row is not one of the limited data rows.
In D1, select both columns, order by units descending, and keep only two products.
Dataset
Starter sheet. Cells marked formula are where the formula goes.
| Row | A | B | C | D | E |
|---|---|---|---|---|---|
| 1 | Product | Units | Formula goes in D1. formula | ||
| 2 | Pen | 10 | |||
| 3 | Book | 25 | |||
| 4 | Clip | 8 | |||
| 5 | Desk | 40 |
Hint
Put limit 2 at the end of the query, after order by B desc.
Explanation
Descending order puts Desk and Book first. limit 2 drops Pen and Clip, and the header remains in the first result row.
The interactive sheet and a worked solution are part of Formula Drills Premium. The instructions and starter data on this page are the full problem.