If you have data formatted as a table, you can use table formulas (for example, [@ABC]) instead of A1 format (for example, A1, $ C2, etc.). But there are two tricks to consider.
Firstly, there is no table formula syntax for the previous row, instead excel will return to A1 format by default, but you can use the offset formula to move the current cell to the previous row, as shown below. However, in this case it will return an # value error, as I am tilting +1 to "ABC".
ABC 1 =OFFSET([@ABC],-1,0)+1 2 =OFFSET([@ABC],-1,0)+1 3 =OFFSET([@ABC],-1,0)+1 4 ....
So, the second trick is to use the if statement to initialize the value, buying a check if the value of the previous line = course value. If you use the initial else value, add an increment. Note. Estimated table called Table1
ABC 1 =IF(OFFSET([@ABC],-1,0)=Table1[[
Note that you can set the initial value as a cell outside the table to determine the initial value (for example, $ A $ 1) and the increment (in the case of $ A $ 2), as shown below
ABC 1 =IF(OFFSET([@ABC],-1,0)=Table1[[
I use this IF OFFSET combination all the time for iterating and looping in tables.
If you have many columns that need to determine if they are the first row, you can have one column if the first row and the rest can work with a simpler if. for example, ABC will return true for the first line false for others, then DEF in increments of the initial value
ABC DEF 1 =OFFSET([@ABC],-1,0)=Table1[[
Hope that helps