Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
900 views
in Technique[技术] by (71.8m points)

excel - Numbering/sequencing sets of same column values

How to do numbering/sequencing for sets of same column values? For example:

Col1 Col2
Andy  1
Chad  1
Bill  1 
Andy  2
Bill  2
Bill  3
Chad  2
Bill  4

Since Andy got 2 values, I want to number it 1 and 2 in Column 2. For Bill, I want to number it 1, 2, 3 and 4 and so on.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...