30 Advanced Excel Tips for 2026

Excel Champs / Pivot Table / How to Add Ranks in Pivot Tables in Excel
By Puneet Gogia (Microsoft MVP)

How to Add Ranks in Pivot Tables in Excel

30+ Advanced Excel Tips for 2026

No spam. Only Excel Stuff. God Promise. 😊

Add the field you want to rank to Values a second time, right-click any cell in the second copy and choose Show Values As → Rank Largest to Smallest. In the Base Field box, pick the row field whose items you are ranking, such as Product, and click OK. This needs Excel 2010 or later.

The base field also decides where the ranks restart. With Region and Product both in Rows, choose Product to rank products within each region. If the ranks come out as all 1s or restart in the wrong place, open Show Values As on that column again and change the base field.

Tied values share a rank, but the pivot does not skip the next number: you get 1, 2, 2, 3 where RANK.EQ gives 1, 2, 2, 4. If you need the skipped ranks, add the data to the Data Model and use a measure such as =RANKX(ALL(Sales[Product]),[Total Sales]), which skips after ties by default.

The ranks follow the pivot’s filters and slicers, so a filtered pivot re-ranks only the visible items. Sort the pivot on the value column to read the ranks in order.

Excel 2007 has no rank option. There, sort the pivot by the value, add a calculated field with the formula =1, and set it to Show Values As → Running Total In the row field. This numbers the rows 1, 2, 3 but does not give tied values the same rank.

By using a pivot table, you can summarize your data in an understandable manner. And that summary can help you analyze data category-wise, product-wise, month-wise, etc.

One of the common practices for analyzing data is ranking it. Ranking categories and products can help you to compare them with each other.

The best part about ranking is that you can check what is at the top and what is at the bottom. If we use ranking in a pivot table, we can save a lot of time and effort, and it will help us in our analysis.

So today, in this post, I’d like to show you 4 different methods to add a rank column in a pivot table.

NOTE: Pivot tables are one of the INTERMEDIATE EXCEL SKILLS and ranking in a pivot table is one of the advanced pivot table skills.

Add Pivot Table Rank in Excel 2010 and Above

  1. Add the value field for which you want to measure the ranking twice in the pivot table.
    Add Ranks In Pivot Table In Excel 2010 & Above
  2. Select any of the cells from the second data column and right-click on it.
  3. Go to “Show Values As”. You have two different options to add ranking: “Rank Smallest to Largest” or “Rank Largest to Smallest”. Select the one you want to use, then select the base field (the row field you want to rank, like the category) and click OK.
    Add Ranks In Pivot Table in Excel
  4. It will convert the column values into ranks, and after that, just sort your data to analyze the ranking.
    Add Ranks In Pivot Table in Excel

This is the easiest method to add ranking to a pivot table if you are using Excel 2010 or a later version.

While using this method, ranks will change when you filter the pivot table.

Add Pivot Table Rank in Excel 2007 and Below

  1. First, sort the pivot table by the values on which you want to calculate the ranking (largest to smallest if you want rank 1 for the highest value).
    Add Ranks In Pivot Table in Excel
  2. After that, open the calculated field dialog box and enter “=1” in the formula input bar.
    Add Ranks In Pivot Table in Excel
  3. This will add a new field in your pivot with a value of 1 in all cells.
    Add Rank In Pivot Table Excel 2007 & 2010
  4. Next, select any of the cells in that field and right-click.
  5. Now, select the “Value Field Settings” option, and in the Value Field Settings dialog box, go to the “Show Values As” tab.
  6. From the drop-down list, select “Running Total In”, select your row field as the base field, and click OK.
    Add Rank In Pivot Table Excel 2007 & 2010
  7. Now, you have a column with rankings in your pivot table.
    Add Rank In Pivot Table Excel 2007 & 2010

Alert: Make sure that you have sorted your pivot table in ascending or descending order.

Using RANK.EQ and RANK.AVG in Source Data 

This method is a little bit tricky, but it works like a charm. The benefit of using RANK.EQ and RANK.AVG is that you don’t have to add anything to your pivot table. Just follow these simple steps.

  1. First of all, in your raw data insert a new column and add this formula into the formula bar:
    • =IF(COUNTIF(C$2:C2,C2)>1,””,SUMIFS($E$2:$E$1507,$C$2:$C$1507,C2))
    • (Here’s how the formula works: This formula will add a single total for each category in the column. And, you can use that total to calculate the rank for each category).
    Add Rank Formulas In Raw Data To Add Rank In Pivot Table
  2. Now, add two more columns at the end of your data and add the below formulas in them.
    • =IF(H2=””,0,RANK.EQ(H2,$H$2:$H$1507,1))
    • =IF(H2=””,0,RANK.AVG(H2,$H$2:$H$1507,1))
    • (Here’s how the formula works: RANK.EQ & RANK.AVG will calculate the ranking for the category in your data dump. We have used both of these functions to get different ranking types: for a tie, RANK.EQ gives both items the same rank, while RANK.AVG gives them the average rank. The last argument, 1, ranks the smallest total as 1; use 0 to rank the largest total as 1.)
  3. After that, create a pivot table using this data dump, just like below. You can use either of the two columns to calculate the ranking. Add it to the Values area with Sum: as each category has its rank in only one row (0 in the others), the sum is the rank.
    Create Pivot Table To Add Rank In Pivot Table Create Pivot Table

Important: While using this method, the ranking will not change when you filter the items.

Add a Separate Rank Column in a Pivot Table

Instead of changing the pivot table or the source data, you can also add a separate rank column next to the pivot table. When you want to add ranks for a one-off report, you can use this method. Just follow these simple steps.

  1. Take a pivot table and sort the values in ascending or descending order as you like.
    Sort Data To Add Rank In Pivot Table Create Pivot Table
  2. And in the next two columns outside the pivot table, add the below formulas.
    • =RANK.EQ(E4,$E$4:$E$15,1)
    • =RANK.AVG(E4,$E$4:$E$15,1)
  3. Drag them below and you have the ranking along with the pivot table.
    Add Formulas To Add Rank In Pivot Table Create Pivot Table

Just keep in mind that these formulas don’t move with the pivot table. If the pivot table grows, shrinks or changes its sort order, update the formula range, or use one of the methods above.

Rank within Each Group of a Pivot Table

Let’s say you have regions in the rows and products under each region, and you want to rank the products within each region. With the first method, the base field decides this:

  1. First of all, right-click a cell in the second value column and go to Show Values As ➜ Rank Largest to Smallest.
  2. After that, in the Base field box, select Product (the inner field), not Region.
  3. In the end, click OK. Now the ranking starts again from 1 in each region.

If you select Region as the base field instead, Excel ranks the regions against each other. Items with the same value get the same rank, just like RANK.EQ.

Frequently Asked Questions

Why is “Rank Largest to Smallest” missing from Show Values As?

The rank options were added in Excel 2010. In Excel 2007 and earlier, use the Running Total In method shown above.

How do I show only the top 5 items by rank?

Click the filter button of the row field and go to Value Filters ➜ Top 10. Change 10 to 5, select the value field, and click OK. The rank column then shows 1 to 5.

Does the rank update when I refresh the pivot table?

Yes, for the Show Values As method and the source data formulas (after the formulas recalculate). The separate column outside the pivot table updates too, but only if its range still matches the pivot table.

Sample File

download

11 thoughts on “How to Add Ranks in Pivot Tables in Excel”

  1. could you please share info on how to apply rank in pivot table with multiple criteria?

    Reply
  2. Hi, great article.

    I have a problem with using rank in pivot table when there is a tie. In excel if you use the rank formula and if there is a tie in second place it would show, rank 1 2 2 4 5 6 etc. But in the pivot table rank, it shows rank 1 2 2 3 4 5. Is there a way to fix this? My raw data has too many criteria to try and use method 2. My pivots have filters which makes method 3 incredibly messy.

    Reply
  3. It is working with single column value when I insert more column it shows value 1 only.

    Reply
  4. Hi – Can we apply rank in pivot table on multiple criteria?
    If Yes, please share its detail or any other useful medium to perform it.
    Regards

    Reply
  5. Hi,
    This solution does not word with my specific problem:
    I have a Pivot with 5 different fields as rows, lets say A, B.C, D & E.
    When I want to show values as RANK, excel request to specify the Base Field, and although I tried with all them (from A to E), it does not work.

    Would you mind to explain how to do it when there are several fields in rows?

    Thanks!!!

    Reply
  6. When using Rank within the PivotTable how we use a second criteria column to break ties?

    Reply
  7. Useful Article. I use the RANK function most often, but when I have to use Pivot tables, I use the ranking feature within Pivot table. While using Rank functions, I use in conjunction with COUNTIF to break ties. Best wishes.

    Reply

Leave a Comment