How to Find Your Top Customers by Revenue in Google Sheets
Total every customer's sales, sort biggest first, keep the top ten. One QUERY formula does it, and the sample data below shows exactly what comes back.
The short answer: =QUERY(Orders!A:K, "select C, sum(J) where year(A) = 2026 group by C order by sum(J) desc limit 10 label sum(J) 'Revenue'", 1). It groups the order lines by customer, adds up revenue, and returns the ten biggest. In the sample data, Corner Coffee House leads with $54,529 in 2026.
The sample data
| A | B | C | D | E | F | G | H | I | J | K | |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | Date | Order ID | Customer | Region | Channel | Product | Category | Qty | Unit price | Revenue | Cost |
| 2 | 2025-01-01 | SO-10001 | Tin Roof Café | Northeast | Sales rep | Sip Lids (case of 1,000) | Supplies | 6 | 54 | 324 | 198 |
| 3 | 2025-01-01 | SO-10001 | Tin Roof Café | Northeast | Sales rep | Espresso Roast 5 lb | Coffee | 10 | 68 | 680 | 370 |
| 4 | 2025-01-01 | SO-10002 | Foxglove Café | Northeast | Online store | Sip Lids (case of 1,000) | Supplies | 1 | 54 | 54 | 33 |
| 5 | 2025-01-01 | SO-10002 | Foxglove Café | Northeast | Online store | Cold Brew Concentrate 1 gal | Coffee | 8 | 42 | 336 | 152 |
| 6 | 2025-01-01 | SO-10003 | Ember Café | Midwest | Online store | Sip Lids (case of 1,000) | Supplies | 4 | 54 | 216 | 132 |
| … | 8,115 more rows | ||||||||||
Sample data: a tab named Orders with 8,120 order lines from January 2025 to October 2026, one row per order line. Revenue is Qty × Unit price; Cost is the line's cost of goods (Qty × unit cost). Download orders.csv and import it (File → Import) to follow along. The business is fictional.
The classic way: QUERY with GROUP BY
Add a tab for the answer and type this in A1. It reads the whole Orders tab (header in row 1), keeps 2026 rows, totals column J (Revenue) per customer in column C, and sorts the totals biggest first:
=QUERY(Orders!A:K, "select C, sum(J) where year(A) = 2026 group by C order by sum(J) desc limit 10 label sum(J) 'Revenue'", 1)
What each part does: group by C makes one row per customer, sum(J) adds their revenue, order by sum(J) desc puts the biggest first, limit 10 keeps ten, and label sum(J) 'Revenue' replaces the default heading "sum Revenue". Drop where year(A) = 2026 for all time, or use where A >= date '2026-07-01' for a custom start date (QUERY dates must be written date 'yyyy-mm-dd').
| A | B | |
|---|---|---|
| 1 | Customer | Revenue |
| 2 | Corner Coffee House | $54,529 |
| 3 | Ivy Lane Office Pantry | $54,160 |
| 4 | West End Café | $52,733 |
| 5 | Tin Roof Kitchen | $52,656 |
| 6 | Mill Pond Market | $51,414 |
| 7 | Blue Door Bistro | $50,092 |
| 8 | Juniper Kitchen | $47,387 |
| 9 | Highline Café | $46,732 |
| 10 | Willow Coffee House | $46,366 |
| 11 | Ember Café | $45,641 |
Computed from the sample CSV above. Cells formatted as currency and percent.
Prefer a pivot table? Select the Orders data, then Insert → Pivot table. Add Customer under Rows and Revenue under Values (SUM). In the Rows settings, sort by SUM of Revenue, descending. Add Date as a filter to limit it to 2026. Same numbers, but you set the top-10 cut yourself.
Gotchas
- One customer, two spellings. "West End Café" and "West End Cafe " (trailing space) group as two customers and both rank lower than they should. Clean the column first with
=TRIM(), or group on a customer ID if your export has one. - Dates stored as text. If
year(A)returns nothing, column A holds text that looks like dates. Re-import with Format → Number → Date, or convert with=DATEVALUE(). - Refunds. If refunds sit on separate negative rows, they reduce a customer's total, which is usually what you want. If they live in another tab, they are not in this number.
- Mixed types in a column. QUERY treats each column as one type, decided by most of its cells. A few text values in a number column come back blank.
The one-cell way: =QUIRIZ
With the Quiriz add-on for Google Sheets, you type the question instead of building the formula. =QUIRIZ does not read the cells around it: it answers from the datasets in your Quiriz account. For this example, upload orders.csv as a dataset, or connect your Shopify store. You can also add a Google Sheet itself as a dataset that refreshes on a schedule. Then, in any empty cell:
=QUIRIZ("top 10 customers by revenue in 2026", "table")
The "table" mode spills the answer down and to the right from that cell, header row first:
| A | B | |
|---|---|---|
| 1 | Customer | Revenue |
| 2 | Corner Coffee House | $54,529 |
| 3 | Ivy Lane Office Pantry | $54,160 |
| 4 | West End Café | $52,733 |
| 5 | Tin Roof Kitchen | $52,656 |
| 6 | Mill Pond Market | $51,414 |
| 7 | Blue Door Bistro | $50,092 |
| 8 | Juniper Kitchen | $47,387 |
| 9 | Highline Café | $46,732 |
| 10 | Willow Coffee House | $46,366 |
| 11 | Ember Café | $45,641 |
Same figures as the formula result above, from the same sample data. The spilled cells are plain numbers, so you can format them, total them or chart them; here they are formatted as currency and percent. Column headings are written with each answer and may be worded differently.
The other modes: "verbose" (the default) answers in a sentence, "bullets" writes two to four points one per cell, and "notes" adds how the figure was calculated. Install Quiriz for Google Sheets and try the question on your own data.
Ask the question, get the table
Quiriz answers business questions in a Google Sheets cell, from your imported files, scheduled Google Sheets and connected tools. Free to start.
Install for Google Sheets →Free on the Google Workspace Marketplace. Or try it on sample data first, no signup.