Numbering/sequencing sets of same column values

孤者浪人 提交于 2019-11-29 12:58:25

You can accomplish this with countif and a sliding range :

   A        B
1  val1     =COUNTIF($A$1:A1, A1)
2  valx     =COUNTIF($A$1:A2, A2)

and so on.

The formula in column B can be dragged down / autofilled in the column. It anchors to the start of the range and only looks as far down as the value we are numbering; COUNTIF is tallying up the matching values in the preceding set this way.

Some Guy

That is kind of slow when your list is really long. I've found sorting the column A to Z or small to larger and then using this formula is much faster:

=IF(A2=A1, A1+1,1)

Basically if the value above is the same then add one to the count else start over at 1

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!