This post will guide you how to ranking with multiple criteria in excel. How do I rank data with multiple criteria in excel. How to rank data with multiple conditions in excel. How to rank data with multiple references using an excel formula.
Table of Contents
1. Rank Data with Multiple Criteria
If you want to rank data with only one condition or one reference, you just only need to use the RANK function to easily rank values in a range of cells in excel. Assuming that you want to rank data against multiple criteria for a range of cells in your worksheet. How to achieve it. You need to create a new complex formula based on the SUMPRODUCT function. For example, you want to rank a list of data in the range of cells A1:B4 with two references or criteria, just using the following formula:
=1+SUMPRODUCT(($A$1:$A$4=A1)*($B$1:$B$4>B1))
You need to type this formula into the formula box of cell C1, and then press Enter key, and drag the AutoFill Handler over other cells.
Let’s see the result:
2. Rank Data with Multiple Criteria using VBA
let’s venture into the realm of VBA magic with our second method—a user-defined function tailored for ranking data with precision. Let’s explore this personalized approach:
Step1: Press Alt + F11 to open the Visual Basic for Applications (VBA) editor.
Step2:In the editor, go to Insert > Module to add a new module.
Step3:Copy and paste the provided VBA code into the module.
Function RankWithCriteria(value As Variant, rangeValues As Range, criteria As Variant, rangeCriteria As Range) As Long
Dim count As Long
Dim i As Long
count = 1
For i = 1 To rangeValues.Rows.count
If rangeValues.Cells(i, 1).value = value And rangeCriteria.Cells(i, 1).value > criteria Then
count = count + 1
End If
Next i
RankWithCriteria = count
End Function
Step4:Close the VBA editor.
Step5:Return to your Excel workbook. In a cell, type:
=RankWithCriteria(A1, $A$1:$A$4, B1, $B$1:$B$4)
Step5: Press Enter, and witness the VBA magic ranking your data with multiple criteria.
3. Video: Rank Data with Multiple Criteria
This Excel video tutorial, we embark on a journey to master the art of ranking data with multiple criteria. Our toolkit includes two potent methods—a formulaic marvel in Excel and a VBA-powered user-defined function.
4. Related Functions
- Excel SUMPRODUCT function
The Excel SUMPRODUCT function multiplies corresponding components in the given one or more arrays or ranges, and returns the sum of those products.The syntax of the SUMPRODUCT function is as below:= SUMPRODUCT (array1,[array2],…)…
Leave a Reply
You must be logged in to post a comment.