How to autofill a cell with an incrementing number for each time a value appears in another column

Column formula request:
I'm trying to assign a numeric value to a cell and increment up for each instance a code shows up in another column.
For example, if a column has NH002 in it 4 times, the first time, the cell should have a value of 1, and repeat until it gets to 4. Once NH003 starts, it would start over at 1 and count up.
I figured "=IF(" would be the start, but not even sure where to go from there to get it to increment.
Best Answer
-
If I understand correctly from you other post you are getting these submission weekly so you could use the week number based on submission date. Using min(collect to find the first entry and subtract it from the current weeknumber
Answers
-
=IF( ([col]@row="NH002"),Count ([helper]1:[helper]@row) ,"")
helper:
=IF( [col]@row="NH002",1,"")
-
Thanks @Intern98 , this works to an extent. I would need to adjust the formula every time we get to a new code specifically for that row or series of rows. I wouldn't be able to make it a column formula.
-
If I understand correctly from you other post you are getting these submission weekly so you could use the week number based on submission date. Using min(collect to find the first entry and subtract it from the current weeknumber