In this guide, we’ll show you how to create a top 10 list in Microsoft Excel in three different ways. Depending on your version of Excel, you can choose the method that works best for your files.
Of course, the same logic applies to creating a top 5, worst 10, and so on, you’ll only need to make minor adjustments to the formulas, but you can apply the same approach to all three methods:
Our starting database has the following columns; you might find it useful for further experimentation:
- CUSTOMER: customer's last name
- PRODUCT: Brand Purchased
- DATE: purchase date
- PRICE: purchase price
- MARKET: Target market for the product sold
In this case, we want to create a simple top 10 list of customers using all the information from the starting table. What we’ll need is a way to extract the individual customer names and sum the price for each one. You can follow the step-by-step guide by downloading the file here:
How to Create a Top 10 List in Excel Using Excel for Microsoft 365 Formulas
Since we’re using Excel for Microsoft 365, there are some very simple formulas to achieve this result:

The complete formula is as follows:
=LET(customers,UNIQUE(TBL[CUSTOMER]),
total,SUMIFS(TBL[PRICE],TBL[CUSTOMER],customers),
SORT(HSTACK(customers,total),2,-1))
Let’s break it down:
=LET(customers,UNIQUE(TBL[CUSTOMER]),
This part specifies that we’re using the value “customers” to refer to the list of unique customer names
total,SUMIFS(TBL[PRICE],TBL[CUSTOMER],customers),
In this part, we have the sum of the individual sales prices for each unique customer; in fact, the “customers” value is referenced to speed up the formula, which otherwise would be:
sum,SUMIFS(TBL[PRICE],TBL[CUSTOMER],UNIQUE(TBL[CUSTOMER]),
Returning to our formula:
SORT(HSTACK(customers,total),2,-1))
The two parts, "customers" and "total", are combined so that we have, in a single row (via HSTACK), the customer’s name and the total revenue generated. At this point, we can use SORT, which sorts our result in descending order by the second column (value 2, i.e., revenue) (-1; otherwise, we could enter 1 or leave it blank for ascending order).
If we had wanted to generate statistics for a single brand only (entered in cell P2, just as an example), the formula would have been slightly different since we would have had to add it to the section related to SUMIFS as follows:
=LET(customers,UNIQUE(TBL[CUSTOMER]),
total,SUMIFS(TBL[PRICE],TBL[CUSTOMER],customers,TBL[PRODUCT],P2),
SORT(HSTACK(customers,total),2,-1))
However, these are all customers, if we wanted to find only the top 10 (or 25, 100), we could simply do this, since we entered the number 10 in cell M2:

=TAKE(LET(customers,UNIQUE(TBL[CUSTOMER]),
total,SUMIFS(TBL[PRICE],TBL[CUSTOMER],customers),
SORT(HSTACK(customers,total),2,-1)),M2)
The TAKE function takes the values from the entire array and considers only the first 10 values: since we’ve sorted them in descending order, this formula will include our top 10 customers while excluding the others.
With GROUPBY you get the same result with a shorter formula, which groups, sums and sorts the customers in a single step:
=TAKE(GROUPBY(TBL[CUSTOMER],TBL[PRICE],SUM,0,0,-2),M2)
If you don’t have Excel for Microsoft 365, the situation gets a bit more complicated since you’d also have to handle duplicate values. There are solutions compatible with earlier versions, though they certainly won’t be as straightforward.
I’d suggest looking at the following solutions (Power Query and Pivot) rather than trying to work with formulas, unless you have a very specific need.
How to Create a Top 10 List with Power Query
We can also create a top 10-style ranking with Power Query, avoiding the need to work with formulas. In this case, we’ll use the source data already in the file, but of course, you could replicate the process using any file you have available.
The steps are as follows:
- Click in the source table
- Load the data by clicking Data > Get Data > From Table/Range. This is because we’re working with a table, but we can also use CSV, PDF, and so on

- At this point, Power Query takes us directly to its interface and has already changed the data type of the source data. We can change the price format by specifying the currency and replacing “nullable number” with the value Currency.Type in the code section for Price

- All that’s left is to group by individual customer by clicking Home > Group By. We can then group by summing the price values, which will create a new column called TOTAL. As you can see, you can perform all these steps directly on the screen, without using functions

- Power Query now returns only the CUSTOMER column and the TOTAL column. In this case as well, we can change the type to Currency.Type directly via code (or by adding an intermediate step: click the small icon with “123” next to the TOTAL header)

- At this point, we can click directly to sort the TOTAL column from Z to A (in descending order), thereby listing all customers in order from most important to least important

- Click Close and Load, located in the top-left corner. Doing so will cause Power Query to create our table with all the information we’ve summarized in our Power Query operations
In terms of code, Power Query performs the following operations:

let
Source = Excel.CurrentWorkbook(){[Name="TBL"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(Source,{{"CUSTOMER", type text}, {"PRODUCT", type text}, {"DATE", type datetime}, {"PRICE", Currency.Type}, {"MARKET", type text}}),
#"Grouped Rows" = Table.Group(#"Changed Type", {"CUSTOMER"}, {{"TOTAL", each List.Sum([PRICE]), Currency.Type}}),
#"Sorted Rows" = Table.Sort(#"Grouped Rows",{{"TOTAL", Order.Descending}})
in
#"Sorted Rows"
What you see is M code, automatically generated by Excel when working in Power Query. You don’t need to learn how to use it in detail, but it might come in handy for certain specific functions. Let’s take a closer look:
let
Source = Excel.CurrentWorkbook(){[Name="TBL"]}[Content],
The source of our data is the same file (Excel.CurrentWorkbook) and is the table named TBL.
#"Changed Type" = Table.TransformColumnTypes(Source,{{"CUSTOMER", type text}, {"PRODUCT", type text}, {"DATE", type datetime}, {"PRICE", Currency.Type}, {"MARKET", type text}}),
Power Query automatically changes the data types for all columns in the table it encounters using the Table.TransformColumnTypes function, so it treats the CUSTOMER, PRODUCT, and MARKET columns as text, while the DATE column has a date/time format and the PRICE column has a currency format. As mentioned earlier, this was the only thing I changed from M, since Power Query had originally interpreted it as a numeric value (nullable number); however, this is a minor detail, as we could easily have modified it later
#"Grouped Rows" = Table.Group(#"Changed Type", {"CUSTOMER"}, {{"TOTAL", each List.Sum([PRICE]), Currency.Type}}),
As we can see, M always references the previous entry (Type Modified), since we’re working step by step. In this case, we’re grouping the values (Table.Group) to obtain, for each individual CUSTOMER, the total of the PRICE column. This column should be named TOTAL and will also be in currency format.
#"Sorted Rows" = Table.Sort(#"Grouped Rows",{{"TOTAL", Order.Descending}})
in
#"Sorted Rows"
At this point, all that’s left is to sort the result (Table.Sort) in descending order (Order.Descending). We’ll then have an output table sorted by total revenue for each individual customer, and Power Query will return this as the final value (in).
Again, if we wanted to keep only the first 10 rows, we’d need to take an additional step (a non-dynamic one, unlike the formulas):

let
Source = Excel.CurrentWorkbook(){[Name="TBL"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(Source,{{"CUSTOMER", type text}, {"PRODUCT", type text}, {"DATE", type datetime}, {"PRICE", Currency.Type}, {"MARKET", type text}}),
#"Grouped Rows" = Table.Group(#"Changed Type", {"CUSTOMER"}, {{"TOTAL", each List.Sum([PRICE]), Currency.Type}}),
#"Sorted Rows" = Table.Sort(#"Grouped Rows",{{"TOTAL", Order.Descending}}),
#"Kept First Rows" = Table.FirstN(#"Sorted Rows",10)
in
#"Kept First Rows"
We’re keeping only the first 10 rows (Table.FirstN), but we could clearly have chosen whichever value suited us best. The rest of the process, up to this point, remains exactly the same as before.
As a best practice, we should have renamed the individual steps to be more descriptive; for example, instead of “Group Rows,” we could have written “Group by Customer” and so on. This can be done by right-clicking on the individual queries in the right-hand panel labeled “Query Settings.”
How to Create a Top 10 List in Excel Using PivotTables
We can also avoid using formulas or Power Query by simply creating a PivotTable that allows us to find the top 10 customers in our database.
The steps to find our top 10 are as follows:
- Click inside the table to open the Table Design tab. From here, click “Summarize with PivotTable.” Generally, I don’t recommend using the suggested PivotTables, since they produce a result right away but aren’t always aligned with what we’re looking for

- At this point, we can move the CUSTOMER field to the Rows section and the PRICE field to the Values section. Excel automatically recognizes that the PRICE values are numeric, so it sums them

- We get a PivotTable with the results for each individual customer. The “Sum of PRICE” header can be changed either by clicking on cell C3 (in the example) or by using the context menu in the “Values” section. I then changed the name from “Sum of PRICE” to “TOTAL,” but the logic remains the same

- At this point, we can select CUSTOMER and then click on “More Sort Options”

- From here, we can choose to sort by TOTAL in descending order. We’ll then see the largest TOTAL values first, followed by the smaller ones, so we’ll start with the most important customers and work down to the least important ones

- Et voilà! We have our PivotTable with all the data sorted. From here, we can see at a glance the most important customers, such as Caruso, Grasso, and Moretti.

To get to the top 10, we just need one more step, if necessary:
- By clicking on the CUSTOMER column again, we can go to “Filter by Values” and then select “Top 10.” This option is a bit hidden, but you’ll find it at the bottom of the list:

- We can now choose how many customers we’re interested in. In this case, we’ll stick with 10, since we’re looking at the 10 largest items for TOTAL_PRICE (which is still the column for TOTAL, but with a different name)

- The PivotTable is now complete, since we’re seeing only the top 10 customers and all others have been filtered out!

And that brings us to the end of the guide! The approach to achieving the result varies greatly, but I think it’s interesting to explore these methods since, in some cases, it will be easier to use a PivotTable (for example, if there’s a large amount of source data), Power Query (if we need to integrate data and then obtain only a concise output without the option to filter), or formulas (for fully dynamic solutions).
Conclusion
You can create a top 10 list with formulas such as UNIQUE, SUMIFS, SORT, TAKE or GROUPBY, with Power Query, or with a PivotTable and its Top 10 filter. Formulas and PivotTables update quickly, while Power Query is best when the data comes from external sources.
If you’d like to download the file that accompanies this guide, click here:
