How do I count consecutive same values

后端 未结 3 1630
北恋
北恋 2021-01-07 07:00

I would like formulas that count the number of consecutive occurrences in a list of values and places the amount of times it occurs in the next columns.

Here is a sp

3条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-07 07:20

    This will do it. It assumes your values are in A2:A11. Note that the range in the formula extends to A12. This is an array formula and needs to be entered with Ctrl-Shift-Enter. Enter it in B2 and copy down:

    =IF(A1=A2,B1,MATCH(FALSE,$A2:$A$12=A2,0)-1)
    

提交回复
热议问题