简体   繁体   English

根据x乘y单元格值填充单元格

[英]Populate cells based on x by y cell value

I'm trying to populate cells based on values from two different cells. 我试图根据来自两个不同单元格的值填充单元格。 Values in the cell needs to be (n-1) where n is the input and then repeated based on the amount of the other cell. 单元格中的值必须为(n-1),其中n是输入,然后根据另一个单元格的数量重复。

For example, I have input: 例如,我输入了:

x     y  
2     5

Output should be: 输出应为:

  • x should have 0 and 1 ; x应该有01 ; each repeated five times 每次重复五次
  • y should have 0 , 1 , 2 , 3 , 4 ; ý应该具有01234 ; each repeated twice 每个重复两次
x1   y1  
0    0  
0    1  
0    2  
0    3  
0    4  
1    0  
1    1  
1    2  
1    3  
1    4

I used: 我用了:

=IF(ROW()<=C2+1,K2-1,"")

and

=IF(ROW()<=d2+1,K2-1,"")

but it is not repeating and I only see: 但它没有重复,我只看到:

x   y  
0   0  
1   1  
__  2  
__  3  
__  4

(C2 and D2 are where values for x and y are, K is the number of items.) (C2和D2是x和y的值,K是项数。)

Are there any suggestions on how I can do this? 关于如何执行此操作有什么建议吗?

In Row2 and copied down to suit: 在第2行中并向下复制以适合:

=IF(ROW()<=1+C$2*D$2,INT((ROW()-2)/D$2),"")

and

=IF(ROW()<=1+C$2*D$2,MOD(ROW()-2,D$2),"")

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM