Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

enter image description here

share|improve this question

marked as duplicate by Devdatta Tengshe, whuber Feb 19 '13 at 6:44

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

I was able to get some help from someone here, and thought I would share the results:

counter = 0
p_name = ""

def count_values(name):
  global counter
  global p_name

if p_name == "":
  counter += 1
elif p_name == name:
  counter += 1
elif p_name != name:
  counter = 1

p_name = name

return counter
__esri_field_calculator_splitter__
count_values(!Name!)
share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.