开发者

Print number x number of times based on value of a cell

I have one column with a certain ID number an A1, and another number in B1. How can I make a cell with A1 written as many times as the number in B1 (taking for granted the f开发者_StackOverflow中文版ormula can be extrapolated downward.)


You want to make use of the REPT function, like this:

      A      B
      ---    ---
1:    42     5
2:    =REPT(A1, B1)

This will output:

4242424242


In C1

=IF(ROW()<=$B$1,$A$1,"")

and copy down for the largest B1 you expect. It will put whatever is in A1 in C1:C?. It checks the row of the the cell that contains the formula, ROW(), against the number in B1. If you're starting in a row other than row 1, you'll need to adjust. For example, if you're starting in row 6

=IF(ROW()-5<=$B$6,$A$6,"")
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜