如何在特定单元格下创建一个空行?

huangapple go评论67阅读模式
英文:

How to create a blank row under specific cells?

问题

我正在尝试创建一个公式,以在下面的范围中每次日期变化时创建一行空白行。
这将是最终目标:

日期 字母
06/12 b
06/12 c
06/12 d
06/13 e
06/13 f
06/13 g
06/14 h
06/14 i
06/14 j
英文:

I'm trying to create a formula to read and transform the range bellow creating a blank row every time the date changes.
This would be the end goal:

Date Letter
06/12 b
06/12 c
06/12 d
06/13 e
06/13 f
06/13 g
06/14 h
06/14 i
06/14 j

答案1

得分: 1

=假设您的日期在A2:A范围内,您可以使用:

=REDUCE(TOCOL(,1),A2:A,LAMBDA(a,c,{a;IF(c=OFFSET(c,1,),c,{c;""})}))

更新

=REDUCE(TOCOL(,1),SEQUENCE(COUNT(A2:A)),LAMBDA(a,c,LET(d,INDEX(A2:A,c),l,INDEX(B2:B,c),VSTACK(a,IF(d=OFFSET(d,1,),{d,l},{d,l;""})))))

或:

=LET(_,LAMBDA(o,REDUCE(TOCOL(,1),A2:A,LAMBDA(a,c,{a;IF(c<>OFFSET(c,1,),{OFFSET(c,,o);""},OFFSET(c,,o))}))),{_(0),_(1)})
英文:

Assuming you have the dates in the range A2:A, you can use:

=REDUCE(TOCOL(,1),A2:A,LAMBDA(a,c,{a;IF(c=OFFSET(c,1,),c,{c;&quot;&quot;})}))

Update

=REDUCE(TOCOL(,1),SEQUENCE(COUNT(A2:A)),LAMBDA(a,c,LET(d,INDEX(A2:A,c),l,INDEX(B2:B,c),VSTACK(a,IF(d=OFFSET(d,1,),{d,l},{d,l;&quot;&quot;,&quot;&quot;})))))

Or:

=LET(_,LAMBDA(o,REDUCE(TOCOL(,1),A2:A,LAMBDA(a,c,{a;IF(c&lt;&gt;OFFSET(c,1,),{OFFSET(c,,o);&quot;&quot;},OFFSET(c,,o))}))),{_(0),_(1)})

答案2

得分: 1

尝试以下公式-

=REDUCE(A1:B1,A2:INDEX(A2:A,COUNTA(A2:A)), LAMBDA(a,x, VSTACK(a, IF(x=INDEX(A:A,ROW(x)+1), INDEX(A:B,ROW(x)), VSTACK(INDEX(A:B,ROW(x)),HSTACK(" "," ")) ) ) ) )

如何在特定单元格下创建一个空行?

英文:

Try the following formula-

=REDUCE(A1:B1,A2:INDEX(A2:A,COUNTA(A2:A)),
	LAMBDA(a,x,
		VSTACK(a,
			IF(x=INDEX(A:A,ROW(x)+1),
				INDEX(A:B,ROW(x)),
				VSTACK(INDEX(A:B,ROW(x)),HSTACK(&quot; &quot;,&quot; &quot;))
				)
			)
		)
	)

如何在特定单元格下创建一个空行?

huangapple
  • 本文由 发表于 2023年6月12日 07:53:47
  • 转载请务必保留本文链接:https://go.coder-hub.com/76452956.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定