# Rand Data by the Number of Occurrences in Google sheets

This article will talk about how to sort the specified data in google sheets according to the number of occurrences? How to use google sheets RANK function to sort a given cell range by the number of repetitions of a value?

## Rank Data by the Number of Occurrences

Suppose you have a task that needs to be ranked according to the number of occurrences. How to sort the data in a given cell range by the number of repetitions in google sheets.

First you need to count the number of occurrences of the values in the given data range, and then use the RANK function to sort the data. You can follow the steps below.

Step 1: You first need to copy the list of data and paste it into another data column as follows.

Step 2: Select “Data” Tab and click on the “Data CleanUP” menu, then clicking “remove duplicates” sub menu. The “Remove Duplicates” window will pop up.

Step 3: Click the “Remove duplicates” button and then click the “ok” button, which will remove all duplicate values and keep only one of each value.

Step 4: You can use the following COUNTIF formula to get the number of duplicates of the values in the cell area A1:A8, then press the Enter key and drag the AutoFill Handler until cell D5, so you can easily apply the formula.

`=COUNTIF(\$A\$1:\$A\$8,C2)`

Step 5: You need to use the google sheets RANK function in cell E2 to sort the number of repetitions of the values counted in the previous step, after that press the Enter key and drag the Auto Handler until cell E5.

`=RANK(D2,\$D\$2:\$D\$5)`

Now you can see the result of ranking by the number of repetitions of the value has been calculated.