Search

# Conditional Rank, the easy way [quick tip]

Share

Yesterday, my mate from across the ditch, Hui posted aboutÂ conditional rank formula (RANKIFS) using awesome SUMPRODUCT.

Of course, not everyone can whip up a sumproduct formula like that. On a scale of One to Hui of Excel awesomeness, you would need to be at least an H to write sumproduct or countifs formulas shown in that post. So does it mean, you can’t conditional rank if you don’t know your X from L?

Don’t worry. We got you covered. You can still get your conditional ranks, without inception level array formulas. Simple, use pivot tables instead.

### Two level (or multi-level ranking) with Pivot Tables

Let’s say you have data like this and you want to know what the department level rank of each student.

The process for creating these ranks is ridiculously simple. Just,

1. Insert a pivot table from your data
2. Add level and detail fields to row labels area (in this case, we shall add Department and Student to row labels area)
3. Add field on which you want to rank to values area (ie Score)
4. Right click on value field and go to “Show values as” > “Rank…”
5. Set up base field as the lower level (ie Student in our case)
6. Bingo, your ranking problem is sorted.

Here is a quick demo of how to use ranking feature in Pivot Tables.

### Do you use pivot tables for ranking?

I use them all the time for such complex, filter driven ranking in my reports. While we could use formulas to get similar results, I think Pivots shine when it comes to ranking, as they naturally resolve ties (without complex deduplication logic) and give results in short time. The only problem is we need to refresh them whenever there is a change in data. But it is a small price to pay for avoiding complex formulas.

What do you think?Â  Do you use pivot tables for ranking your data? Share your stories in the comments section.

Also, check out our Pivot Table Central for all things pivot, right from basics to ninja-level stuff.

### Get FREE Excel + Power BI Tips

Simple, fun and useful emails, once per week.

Learn & be awesome.

### Welcome to Chandoo.org

Thank you so much for visiting. My aim is to make you awesome in Excel & Power BI. I do this by sharing videos, tips, examples and downloads on this website. There are more than 1,000 pages with all things Excel, Power BI, Dashboards & VBA here. Go ahead and spend few minutes to be AWESOME.

Read my storyFREE Excel tips book

Overall I learned a lot and I thought you did a great job of explaining how to do things. This will definitely elevate my reporting in the future.
Rebekah S
Reporting Analyst

From simple to complex, there is a formula for every occasion. Check out the list now.

Calendars, invoices, trackers and much more. All free, fun and fantastic.

Power Query, Data model, DAX, Filters, Slicers, Conditional formats and beautiful charts. It's all here.

Still on fence about Power BI? In this getting started guide, learn what is Power BI, how to get it and how to create your first report from scratch.

### Automatically Format Numbers in Thousands, Millions, Billions in Excel [2 Techniques]

Ever wanted to automatically format values in thousands, millions or billions in Excel? In this article, let me show you two powerful techniques to do just that.

## Related Tips

Keyboard Shortcuts

Learn Excel

### How to make a pivot table when you have data in multiple sheets [Tutorial]

Charts and Graphs

Learn Excel

### These Pivot Table tricks massively save your time

Cool Infographics & Data Visualizations

Excel Howtos

### 8 Responses to “Conditional Rank, the easy way [quick tip]”

1. Andy Ferguson says:

Another, equally easy, way is to use a helper column to deal with the conditions, then use the standard RANK formula.

It's far less awesome than either a pivot table or a SUMPRODUCT / COUNTIFS formula, but it is easy, and everyone's sheet has room for an extra column or two....(or 16,000) ðŸ™‚

• Hui... says:

@Andy

The problem with helper Columns is that you need a Column for every Criteria Combination to segregate each Criteria

• Andy Ferguson says:

...or an IF(AND(...

I take your point, but my experience is usually that my customer only wants to see the data ranked one way at a time, sometimes being able to change the basis at will (eg Period / YTD).

Again - not claiming it's better!

2. Hui... says:

Ha Ha

I actually hadn't even noticed Ian's Rank.
Must be another Ian as I would be in Engineering anyway.

I really should use Pivot Tables more shouldn't I?

• Chandoo says:

Thanks Hui. Yes, they are powerful and simple, so I say Pivot whenever possible. ðŸ™‚

3. Chihiro says:

Neat solution! I tend to use RANKX in PowerPivot DAX to solve conditional rank.

But this is quick and easy solution for all to use. ðŸ™‚

• Chihiro says:

And works across multiple versions of Excel (at least for more than PowerPivot).

4. Sahil says:

I use RANKX as well for solving condition rank. I never knew this solution, Thanks ðŸ™‚

### Get FREE Excel & Power-BI Newsletter

One email per week with Excel and Power BI goodness. Join 100,000+ others and get it free.Â