开发者

Adding of Count in Excel

How do I increment the row count (Cnt) based on the Number column in Excel? Are there any formulas that I can use to generate the Cnt column?

Cnt  Number开发者_如何学编程
1    IF1234
1    IF1234
2    IF4444
2    IF4444
3    IF5555
3    IF5555


If the values in the Number column are sorted (i.e., grouped), you can do the following.

  1. Enter "1" in A2 (the first Cnt value).
  2. Enter =IF(B3=B2,A2,A2+1) in A3, where column B holds the Number values.
  3. Fill down the formula in A3.

If, however, the values in the Number column are NOT sorted, you will need to do the following:

  1. Enter "1" in A2.
  2. Enter =IF(ISERROR(MATCH(B3,B$2:B2,0)),MAX(A$2:A2)+1,INDEX(A$2:A2,MATCH(B3,B$2:B2,0))) in A3.
  3. Fill down the formula in A3.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜