- Insert a new column next to column B (let's say it's column C).
- In cell C1, enter the formula: =IF(A1<A2,1,B1+1)
- Drag the formula down to the last row of your data.
- Column C will now display the row count that restarts each time the value in column A changes.
Explanation of the formula:
-
IF(A1<A2,1,B1+1): This formula checks if the value in cell A1 is different from the value in cell A2. If it is, it means that the value in column A has changed, so it resets the row count to 1. If it's not different, it means that the value in column A is the same as the previous row, so it adds 1 to the row count in the previous row (cell B1).