Rank Based on Specific Value in google sheets

This article will guide you how to sort the values in a given column based on a specific value in another column in google sheets. How to sort a range of values in google sheets by using IF function and COUNTIFS function based on a specific value in another column.

Rank Based on Specific Value in google sheets1

Rank Based on Specific Value

Suppose you have a list with two columns of data, where the first column is a list of products and another column is the number of sales. If you have an urgent need to quickly sort the number of sales for a given product name, you can’t solve this request with the RANK function, because it can only be used to sort values up to one range. So is there a quick and easy way for sorting in google sheets? Of course yes, the following will show how to use the IF function in combination with COUNTIFS function to build a new google sheets formula to solve the problem. The formula is as follows.

For example, if you want to rank the sales values in the range B2:B6 based on the specified product name “excel” in the range A2:A6, then you can use the following formula to get the ranking results:

=IF(A2="excel",COUNTIFS(A$2:A$6,"excel",B$2:B$6,">"&B2)+1,"")

Next, you need to type the above formula in another blank cell and press Enter on your keyboard to apply the formula, and after that you need to drag the autofill handler down to the other cells to apply this formula.

Rank Based on Specific Value in google sheets1

As you can see from the example above, the products in column A, “excel“, can now be ranked by their sales.

Let’s See How This Formula Works

=COUNTIFS(A$2:A$6,”excel”)

This formula is used to count the number of excel product names in a given cell range A2:A6.

Rank Based on Specific Value in google sheets1

=COUNTIFS(B$2:B$6,”>”&B2)

This formula is used to count the number of times that the value in the given cell range B2:B6 is greater than the current sales value.

Rank Based on Specific Value in google sheets1

=COUNTIFS(A$2:A$6,”excel”,B$2:B$6,”>”&B2)

The formula is used to count the number of products with sales greater than the current product sales, and must meet one additional condition is that the product name must be excel.

Rank Based on Specific Value in google sheets5

=COUNTIFS(A$2:A$6,”excel”,B$2:B$6,”>”&B2)+1

The returned result of the above formula adding the number 1 is the actual ranking of the specified product in its own product list.

Rank Based on Specific Value in google sheets1

Related Functions

  • Google Sheets IF function
    The Google Sheets IF function perform a logical test to return one value if the condition is TRUE and return another value if the condition is FALSE. The IF function is a build-in function in Microsoft Excel and it is categorized as a Logical Function.The syntax of the IF function is as below:= IF (condition, [true_value], [false_value])….
  • Google Sheets COUNTIFS function
    The Google SheetsCOUNTIFS function returns the count of cells in a range that meet one or more criteria. The syntax of the COUNTIFS function is as below:= COUNTIFS(criteria_range1, criteria1, [criteria_range2, criteria2]…)…
Related Posts

Phone Number Format in Excel

Sometimes when we import phone numbers from external sources, the formatting of the phone numbers is removed. Even if in some situations the phone numbers are not imported from external resource, sometimes the phone numbers in worksheet are not displayed ...

Check Cell If Contains One of Many with Exclusions

In Microsoft Excel Spreadsheet or google sheets, when cells contain multiple strings, how can we accomplish this task if you want to check whether these cells contain more than one given string and exclude other given strings? In this article, ...

If Cell Contain Specific Text

This article will explain how to check if a cell contains text or a specific text string in Google Sheets or Microsoft Excel spreadsheets. In our daily work, we often look for specific text in worksheets containing large amounts of ...

Cell Contains Number

This article will talk about how to check if a given cell contains any numbers in Microsoft Excel Spreadsheet or Google Sheets. How to quickly check if a cell contains a number? When you have a small number of cells ...

Cash Denomination Calculator

Every country has different cash denominations, so you may need to calculate the number of different denominations based on the total amount. If it is just a small amount of cash, then you can calculate the different cash denominations manually, ...

Sidebar