import arcpy count=0 # Loop through the table rows = arcpy.UpdateCursor("Table.dbf") for row in rows: # Get the values in the Category & FREQUENCY fields num = row.getValue("Category") freq = row.getValue("FREQUENCY") # Add one to the count count=count+1 # If count is <= the frequency if count <= freq: print "Field value "+str(num)+" assigned a "+str(count) # Write count in field Seq row.Seq = count # Execute the new values to the table rows.updateRow(row) # Reset counter when freq is reached. if count == freq: count=0 print "\nDone.\n"