If your data is in column B (from B2 to B45) and starts from row 2.
- In C2, put the number 1.
- In C3, put the following formula: =IF(B3=B2, C2, C2+1)
- Click on the cell C3, and you will see a small square in the bottom right corner. This is the fill handle. Click and drag it down to the end of your data (until C45). This will apply the formula to all the cells in column C corresponding to your data in column B.
- In column D, put the following formula in D2: =IF(B2<>B1, 1, D1+1)
- Drag down this formula to the end of your data as before.