Listing the Top Five Transactions

Written by Allen Wyatt (last updated March 1, 2025)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, 2021, 2024, and Excel in Microsoft 365


1

Terri has a list of transactions in a worksheet. The first column is a customer name and the second is the transaction amount. Terri knows she could sort or filter the data to determine the top five transactions. However, she wonders if the top five customers and the transaction amount could actually be returned by a formula.

Yes, it is possible to do this and there are many different ways you can approach the problem. In this tip I'm going to look at only a few of those approaches.

First, though, let's make the assumption that the customer names are in column A and that cell A1 has a header in it, such as "Customer." Further, column B contains a header of "Amount" and the rest of the column contains the amounts for each corresponding customer in column A. (See Figure 1.)

Figure 1. Sample data for testing formulas.

Now, let's take a look at an approach that will work in all versions of Excel. Start by placing the values 1, 2, 3, 4, 5 in cells D2:D6. These are your "rank" indicators. Then, in cell F2 you can place the following formula:

=LARGE(B:B,D2)

Copy this formula down to cell F6, and you end up with the five largest transactions in F2:F6. This is because the LARGE function returns the Nth largest value from a range, where the second parameter indicates the rank—in this case 1, 2, 3, 4, or 5.

Now all you need to do is to grab the names related to those transaction amounts. You can do that by putting this formula into cell E2:

=INDEX(A:A,MATCH(F2,B:B,0))

Copy this down to cell E6. The MATCH function matches the amounts in column F against the amounts in column B, and then the INDEX function pulls the corresponding name from column A. You end up with the desired names and transaction amounts in E2:F6. You can even put headers in cells D1:F1, if desired, and format as necessary. (See Figure 2.)

Figure 2. Pulling the top five transactions.

If you are using Excel 2021, 2024, or Excel in Microsoft 365, then you can rely on the newer worksheet functions that are available. A single formula can be used to return the desired information. Here's the one I would place in cell E2:

=FILTER(A2:B1000, B2:B1000 >= LARGE(B2:B1000,5))

The key here is to make sure that the ranges specified include all of the rows in your data. In this case, the range evaluated is A2:B1000, but you can adjust this as needed. The formula returns the top five transactions, though it may return more if there are duplicate transaction amounts in the top five. They are returned in the same order that they appear in the original data. If you would, instead, like them sorted in descending order by the transaction amount, you can wrap the formula in the SORT function:

=SORT(FILTER(A2:B1000,B2:B1000>=LARGE(B2:B1000,5)),2,-1)

Here's another approach that will work in Excel 2021, 2024, and Excel in Microsoft 365, relying on both the SORT and SEQUENCE functions:

=INDEX(SORT(A2:B1000,2,-1), SEQUENCE(5),{1,2})

If you are using Excel in Microsoft 365, then you will have access to the TAKE function, which can shorten the formula even more:

=TAKE(SORT(A2:B1000,2,-1),5,2)

This formula provides a sorted array of the cells, in descending order based on the transaction amount, and then "takes" the first five rows and two columns.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (9261) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, 2021, 2024, and Excel in Microsoft 365.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Entering Dates without Separators

When doing data entry into a worksheet, you might want to enter dates without the need to type the separators that are ...

Discover More

Moving the Underline Position

One of the ways that Word allows you to format text is to underline it. However, you have virtually no control on where ...

Discover More

Monitoring the Number of Formats Defined

The number of formats used in a workbook can become a problem if you run up against the limit Microsoft hard-coded into ...

Discover More

Excel Smarts for Beginners! Featuring the friendly and trusted For Dummies style, this popular guide shows beginners how to get up and running with Excel while also helping more experienced users get comfortable with the newest features. Check out Excel 2019 For Dummies today!

More ExcelTips (ribbon)

Working with Imperial Linear Distances

Excel works with decimal values very easily. It is more difficult for the program to work with non-decimal values, such ...

Discover More

Filling References to Another Workbook

When you create references to cells in other workbooks, Excel, by default, makes the references absolute. This makes it ...

Discover More

Where Is that Text?

Looking for a formula that can return the address of a cell containing a text string? Look no further; the solution is in ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 6 - 3?

2025-03-02 15:41:38

Erik

One thing to note about the first method discussed, using LARGE and INDEX. If there are two people with the exact same amount, the first person will show up in the top five list twice and the second person will not be in the list.


This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.