如何在Excel中连续的列中重复数字x次

时间:2019-06-19 16:05:24

标签: excel rows

我想像-> 1、1、1、1、2、2、2、2、3、3、3、3 ...这样的列表,但是要在excel中的列中。自动执行此操作的公式是什么?

3 个答案:

答案 0 :(得分:2)

使用N(在您使用它的行中使用)。

INT( ROW() / 4 - N ) + 1

答案 1 :(得分:0)

尝试使用 A1

=ROUNDUP(ROW()/4,0)

并向下复制

答案 2 :(得分:0)

如果要使用代码执行此操作,则假设您要在第1行的A列中执行此操作。

x = 1 'the starting row value
y = 1 'the starting column value
z = 12 'the number of entries you ultimately want to make
entryEnd = 4 'the number of entries per value
entryStart = 1 'the start of the entries
a = 0 'the starting number of the list of values

Do While x<=z
entryStart = 1 'reset the value of entryStart    
a = a + 1
    Do While entryStart <= entryEnd
    cells(x, y) = a
    x= x + 1
    entryStart = entryStart + 1
    Loop
Loop