search
HomeTopicsexcelPractical Excel skills sharing: formula routines for ranking according to conditions

When it comes to ranking data in excel, the first thing that comes to mind is the rank function, but what if you want to rank the data according to conditions? Friends, are you confused all of a sudden? It seems that you have not heard of the function of ranking according to conditions. So today I will share with you a formula for ranking according to conditions in Excel. Let’s take a look!

Practical Excel skills sharing: formula routines for ranking according to conditions

Among the Excel functions, there are SUMIF that sums based on conditions, AVERAGEIF that calculates average based on conditions, and COUNTIF that counts based on conditions. In the latest version, there is even The MAXIFS function that finds the maximum value based on conditions and the MINIFS function that finds the minimum value based on conditions are provided. But there is no function that can rank by conditions.

However, problems such as ranking by conditions are indeed encountered in daily life. For example, the following problem is a typical representative of it:

Practical Excel skills sharing: formula routines for ranking according to conditions

We all You know that you can use the RANK function to get the ranking of a number in a set of numbers. In this example, the total ranking is obtained by using the formula =RANK(C2,$C$2:$C$19).

But what to do if you want to get the sales ranking of each store in the region? Do you need to use the RANK function to rank in each region?

Although this is also an idea, the low efficiency can be imagined. In fact, among the Excel functions, there is a function that can achieve ranking by conditions, which is SUMPRODUCT.

Before formally introducing the formula for ranking by conditions, let us first understand the operation principle of ranking by conditions.

Take store 10004 as an example. The regional ranking is 2 and the overall ranking is 10. As shown in the figure:

Practical Excel skills sharing: formula routines for ranking according to conditions

The reason for its regional ranking It is 2, which is easy to understand, because there are only six numbers in the same sales area (condition). Among these six numbers, only one number is greater than 56.55, which is 79.72, so its ranking in the area is 2.

The calculation principle of other rankings is the same. Thinking about it this way, achieving ranking by conditions actually involves two processes: judgment of conditions and judgment of size.

Write these two processes using formulas: $A$2:$A$19=A2 and $C$2:$C$19>C2, you can understand this with examples Two parts.

Look at the first one first, $A$2:$A$19=A2 will get a set of logical values:

{TRUE;TRUE;TRUE; TRUE;TRUE;TRUE;FALSE;FALSE;FALSE;FALSE;FALSE;FALSE;FALSE;FALSE;FALSE;FALSE;FALSE;FALSE}

Practical Excel skills sharing: formula routines for ranking according to conditions

##From this It can be seen from the results that the data in the same area as the store to be counted is TRUE.

$C$2:$C$19>C2 will also get a set of logical values:

{FALSE;TRUE;TRUE;TRUE;TRUE ;TRUE;TRUE;TRUE;TRUE;TRUE;TRUE;TRUE;TRUE;TRUE;TRUE;TRUE;TRUE;TRUE}

Practical Excel skills sharing: formula routines for ranking according to conditions

This result represents sales It will also get TRUE when it is larger than counting stores.

The current question is how to combine these two parts. Because these are two judgments on one data at the same time, multiply the two sets of logical values ​​to see what result is obtained:

Practical Excel skills sharing: formula routines for ranking according to conditions

The group of data in the picture consisting of 0 and 1 is ($A$2:$A$19=A2)*($C$2:$C$19> ;C2) The calculated result shows that in the area where store 10001 is located, there are 4 stores (4 1s) with sales higher than 14.46. You only need to sum the results to basically achieve the purpose of ranking. Therefore, there is a formula:

=SUMPRODUCT(($A$2:$A$19=A2)*($C$2:$C$19>C2))

Practical Excel skills sharing: formula routines for ranking according to conditions

However, there is a problem with the results obtained in this way. The ranking starts from 0. The solution is very simple. There are two methods.

Method 1: Add 1 directly after the formula, the result is as shown in the figure.

Practical Excel skills sharing: formula routines for ranking according to conditions

Method 2: Change the greater than sign to greater than or equal to, the result is as shown in the figure.

Practical Excel skills sharing: formula routines for ranking according to conditions

There is usually no difference between these two methods, and you can use either formula.

The above is a formula for ranking based on one condition. If there are two or more conditions, just expand the formula:

=SUMPRODUCT((condition area 1=condition 1)* (Conditional area 2=Conditional 2)* (Data area>data))

I will not list specific examples. I believe that after everyone understands the principle of the formula, you can combine it with specific problems to solve your own problems. There is absolutely no problem in applying it.

Related learning recommendations: excel tutorial

The above is the detailed content of Practical Excel skills sharing: formula routines for ranking according to conditions. For more information, please follow other related articles on the PHP Chinese website!

Statement
This article is reproduced at:部落窝教育. If there is any infringement, please contact admin@php.cn delete
MEDIAN formula in Excel - practical examplesMEDIAN formula in Excel - practical examplesApr 11, 2025 pm 12:08 PM

This tutorial explains how to calculate the median of numerical data in Excel using the MEDIAN function. The median, a key measure of central tendency, identifies the middle value in a dataset, offering a more robust representation of central tenden

Google Spreadsheet COUNTIF function with formula examplesGoogle Spreadsheet COUNTIF function with formula examplesApr 11, 2025 pm 12:03 PM

Master Google Sheets COUNTIF: A Comprehensive Guide This guide explores the versatile COUNTIF function in Google Sheets, demonstrating its applications beyond simple cell counting. We'll cover various scenarios, from exact and partial matches to han

Excel shared workbook: How to share Excel file for multiple usersExcel shared workbook: How to share Excel file for multiple usersApr 11, 2025 am 11:58 AM

This tutorial provides a comprehensive guide to sharing Excel workbooks, covering various methods, access control, and conflict resolution. Modern Excel versions (2010, 2013, 2016, and later) simplify collaborative editing, eliminating the need to m

How to convert Excel to JPG - save .xls or .xlsx as image fileHow to convert Excel to JPG - save .xls or .xlsx as image fileApr 11, 2025 am 11:31 AM

This tutorial explores various methods for converting .xls files to .jpg images, encompassing both built-in Windows tools and free online converters. Need to create a presentation, share spreadsheet data securely, or design a document? Converting yo

Excel names and named ranges: how to define and use in formulasExcel names and named ranges: how to define and use in formulasApr 11, 2025 am 11:13 AM

This tutorial clarifies the function of Excel names and demonstrates how to define names for cells, ranges, constants, or formulas. It also covers editing, filtering, and deleting defined names. Excel names, while incredibly useful, are often overlo

Standard deviation Excel: functions and formula examplesStandard deviation Excel: functions and formula examplesApr 11, 2025 am 11:01 AM

This tutorial clarifies the distinction between standard deviation and standard error of the mean, guiding you on the optimal Excel functions for standard deviation calculations. In descriptive statistics, the mean and standard deviation are intrinsi

Square root in Excel: SQRT function and other waysSquare root in Excel: SQRT function and other waysApr 11, 2025 am 10:34 AM

This Excel tutorial demonstrates how to calculate square roots and nth roots. Finding the square root is a common mathematical operation, and Excel offers several methods. Methods for Calculating Square Roots in Excel: Using the SQRT Function: The

Google Sheets basics: Learn how to work with Google SpreadsheetsGoogle Sheets basics: Learn how to work with Google SpreadsheetsApr 11, 2025 am 10:23 AM

Unlock the Power of Google Sheets: A Beginner's Guide This tutorial introduces the fundamentals of Google Sheets, a powerful and versatile alternative to MS Excel. Learn how to effortlessly manage spreadsheets, leverage key features, and collaborate

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools