This question already has an answer here:
Is there a way to auto populate a sequence of numbers based on another attribute in a table? For example, if field "Name" has a sequence of numbers from 1 to 10, and I want to number all the rows in the table that associated to "Name = 1" from 1 to 10, and then start this process over when "Name = 2" etc (see attached graphic). Can this be done within the Field Calculator, with a plugin, or does it need to be coded?
Thanks...