enter image description here

I wants to add a auto serial number into my excel sheet which should restart from 1 automatically as soon as the text in the next column changed. For example I have column of subjects i.e English, Hindi, Persian etc. I have sorted there data a-z now I want serial numbers based on this subjects column starting from 1 for each group of subject. I tried this

=IF(E31="","",(SUBTOTAL(103,$E$2:E31)))

but it continued the serial numbers until I filter the data. but I need serial number auto restart on the condition based on subject column. please help.


Solution 1:

You mention "subjects" but your example does not show that column. Using a simplified sample, I would just do this in cell A2:

    =IF(B2=B1,A1+1,1)

Drag it down. enter image description here