Nicolas Vargas
Nicolas Vargas

Reputation: 5

How to repeat a value each x cells?

The idea is to have 2 inputs the number and the number of spaces, so lets say those numbers are 2 & 3 it should look like:

2
0
0
0
2
0
0
0
2

Upvotes: 0

Views: 119

Answers (3)

Gary's Student
Gary's Student

Reputation: 96791

Pick a cell and enter:

=IF(MOD(ROWS($1:1),4)=1,2,0)

and then copy down:

enter image description here

Upvotes: 0

BrakNicku
BrakNicku

Reputation: 5990

If first parameter is in A1, second in B1, you can enter the following formula in any cell, and fill it down:

=IF(MOD(ROW(A1),$B$1+1)=1,$A$1,0)

Upvotes: 1

user4039065
user4039065

Reputation:

Your sample data is confusing in that there are three 2's and three zeroes. It's unclear on what it should look like if the second number was a 4. If it is always three of the first number try something using REPT. With 2 in A1 and 3 in A2,

=A1&rept("0", A2)&A1&rept("0", A2)&A1

Upvotes: 0

Related Questions