0

I have a sort of data that can be seen here:

https://docs.google.com/spreadsheets/d/1jhKTgHbEYtfWkmC6R6ebg2Oc5b5OcL4qO3BYopDiG6g/edit#gid=0

My data is sorted like that in column A from A to Z.

Is there any way to make a sorting number from 1 to any number and reset it to 1 again when column A changes value, just like in column B?

I have tried using MMULT but is there any other way? Since MMULT requires a ton of time to calculate.

ArrayFormula is preferred since it is very convenient to be able to auto-update the return when the value is updated.

player0
  • 124,011
  • 12
  • 67
  • 124
Randy Adikara
  • 357
  • 3
  • 10

2 Answers2

2

try:

=INDEX(IFERROR(1/(1/COUNTIFS(A1:A, A1:A, ROW(A1:A), "<="&ROW(A1:A)))))

enter image description here

player0
  • 124,011
  • 12
  • 67
  • 124
1

This is faster than countifs if you have large amounts of data - plz see this question

=lambda(FILTER,scan(,sequence(rows(filter)),
lambda(a,c,if(c=1,1,if(index(filter,c)=index(filter,c-1),a+1,1)))))
(filter(A:A,A:A<>""))

enter image description here

My answer shows a solution for pre-sorted data: the reference above works for unsorted data.

Tom Sharpe
  • 30,727
  • 5
  • 24
  • 37