Search code examples
excelexcel-2007excel-formula

Excel add serial number column based on another column grouped


We have thousands of rows of data in the following format

| Name       | Born On     |
|:-----------|------------:|
| Tom        |      Jul 15 |
| Harry      |      Jul 15 |
| Katy       |       Oct 2 |
| Britney    |       Oct 2 |
| Miranda    |       Oct 2 |
| Victoria   |       Oct 2 |
| John       |      Sep 30 |
| Warren     |      Sep 30 |
| George     |      Sep 30 |

I would like to add a serial number based on the "Born On" column as follows

| Name       | Born On     | Serial Number
|:-----------|------------:|--------------:|
| Tom        |      Jul 15 |  1
| Harry      |      Jul 15 |  2
| Katy       |       Oct 2 |  1
| Britney    |       Oct 2 |  2
| Miranda    |       Oct 2 |  3
| Victoria   |       Oct 2 |  4
| John       |      Sep 30 |  1
| Warren     |      Sep 30 |  2
| George     |      Sep 30 |  3

The "serial number" needs to be grouped by "born on" date. Please help. Thanks.


Solution

  • If the serial numbers start in cell C2 and the Born on cells start in B2, then use this formula in cell C2 and copy down:

    =COUNTIF(B$2:B2,B2)