问题
So, I have this 120k rows in excel with format.
id number description
1 1 apple
2 1 banana
3 1 pineapple
4 1 b
5 1 c
6 6 d
7 6 e
8 6 f
9 6 g
10 6 e
what formula can I use in the number column so that it will be the same as the table above? every 5th rows I will change the number of number column based on number on the 6th row of id column. Note that number column is blank right now.
回答1:
Although Enigmativity's solution gives you the desired result, the results will vary by the row from where you start your column. Here is how i would recommend to do it.
Enter 1 in the first cell you want to start the pattern from (B2
in my case) .
in the next cell(B3
) enter
=IF(MOD(ROW()-ROW($B$2),5)=0,B2+5,B2)
and copy the formula down. This should give you the desired pattern as long as you update the starting cell address (B2
and $B$2
)
回答2:
Try this:
=5*INT((ROW(RC)-1)/5)+1
I get:
1 1 1 1 1 6 6 6 6 6 11 11 11 11 11 16 16
I used R1C1 notation, but just replace the RC
with the current cell (i.e. B2
) if you're using A1
mode.
来源:https://stackoverflow.com/questions/43750141/excel-counting-pattern-every-5th-rows