根据单行旁边的单元格中的数字生成多行

时间:2019-08-10 16:10:24

标签: google-sheets concatenation transpose google-sheets-formula array-formulas

This SQL question确切说明了我想在Google表格中实现的目标。

是否有可能在Google工作表中创建一些自动化功能,以读取工作表并根据其旁边单元格中的数字将单行更改为多行?

2 个答案:

答案 0 :(得分:0)

=TRANSPOSE(SPLIT(JOIN(",", ARRAYFORMULA(REPT(SPLIT(
 INDIRECT("A1:A"&COUNTA(A1:A)), ",")&",", 
 INDIRECT("B1:B"&COUNTA(B1:B))))), ","))

0

答案 1 :(得分:0)

我不确定您是否要在链接中添加日期的确切示例?

但是无论如何,这是它的公式版本:

=ArrayFormula(if(row(C2:C)<sum(C2:C)+2,
eomonth(vlookup(row(C2:C)-2,{sumif(row(C2:C),"<="&row(C2:C),C2:C)-C2:C,B2:B},2,true)
,row(C2:C)-3-vlookup(row(C2:C)-2,sumif(row(C2:C),"<="&row(C2:C),C2:C)-C2:C,1,true))+1,""))

并获取金额

=ArrayFormula(vlookup(row(C2:C)-2,{sumif(row(C2:C),"<="&row(C2:C),C2:C)-C2:C,E2:E},2,true))

enter image description here