The COUNTIF function in Excel counts the number of cells in a range that match the supplied criteria

range - The range of cells to count. in the example C3 to G7 this range needs to be locked (i.e. row and column preceded by dollar sign) so when you drag the cell down the range stays the same.

criteria - The criteria that controls which cells should be counted. here counting "Chris" which is in cell B9.

so the formula required in cell C9 is

```
=COUNTIF($C$3:$G$7,B9)
```

Select cell C9 then hover over the bottom right hand side of the cell C9 until the Cross hair appears then double click to populate the formula down to cell C20

More information on using countif can be found here https://support.office.com/en-us/article/countif-function-e0de10c6-f885-4e71-abb4-1f464816df34

**EDIT to allow for edited question**

To sort the unique names you will need helper columns

In Cell J3 add the following code (note as indicated by the curly brackets this is entered as an array formula i.e. use Ctrl+Shift+Enter) and then drag down to populate the unique names list.

```
{=INDIRECT(TEXT(MIN(IF(($C$3:$G$7<>"")*(COUNTIF($J$2:J2,$C$3:$G$7)=0),ROW($3:$7)*100+COLUMN($C:$G),7^8)),"R0C00"),)&""}
```

Apply a countif in K3 as before with same range but this time referencing the adjacent unique name cell reference J3 then drag down.

```
=COUNTIF($C$3:$G$7,J3)
```

Now rank the unique names based on their helper count column by using the following formula in I3 and drag down

```
=RANK(K3,$K$3:$K$14,0)+COUNTIF($K3:K$14,K3)-1
```

Add rank position numbers 1 to 12 in A10 to A21
then use VLOOKUPs to match the position number to the ranking in the helper column and return the "Name" and Count respectively.

for B10 enter

```
=VLOOKUP($A10,$I$3:$K$14,2,FALSE)
```

and C10

```
=VLOOKUP($A10,$I$3:$K$14,3,FALSE)
```

Highlight B10 and C10 then drag down to finish.

`COUNTIF`

: exceljet.net/excel-functions/excel-countif-function – Fabian Röling Nov 8 '18 at 21:53