## Excel: How to rank by two columns

*Article updated on July 30, 2017*

**Problem:** How to rank by two columns? Column A are the "group" numbers and column B are the dates. See picture below. So all dates in group 1 should be ranked together, group 2 dates together and so on.

**Solution:**

- Copy formula =SUM((B2>=$B$2:$B$16)*1*(A2=$A$2:$A$16)) into cell C2 and press "CTRL" + Shift" + "Enter"
- Copy the formula to cells below

Let us see what this formula does.

=SUM((B2>=$B$2:$B$16)*1*(A2=$A$2:$A$16))

B2>=$B$2:$B$16 checks if cell value in B2 are bigger or equal than cell values in column B

A2=$A$2:$A$16 checks that only groups together are "summed" and ranked.

**SUM(**number1,[number2],

### Leave a Reply

**How to add a formula to your comment:**

<code>your formula</code>

Remember to convert less than and larger than signs to html character entities before you post your comment.

**How to add VBA code to your comment:**

[vb 1="vbnet" language=","]

VBA code

[/vb]

**How to add a picture to your comment:**

Upload picture to postimage.org

Add picture link to comment.

**Contact Oscar**

You can contact me through this webpage

## Share this article