如何在Excel中重复文本?

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

How to repeat text in excel?

问题

我想请教您的建议。我在这个问题上遇到了困难
如何在Excel中重复文本?
我尝试在Excel中使用REPT函数,但结果显示所有复制的单词都在一个单元格中。我应该如何改进它?

我希望结果像这样
如何在Excel中重复文本?
并按代码从Z到A排序。我该如何做呢?非常感谢。

英文:

I would like to ask for your advices. I have a problem with this
如何在Excel中重复文本?
I tried to use REPT in excel but the result show all multiplied word in on cell. How Can I improve it?

I want to result be like

如何在Excel中重复文本?

and sort from Z to A by code. How can I do it. Thank you so much

答案1

得分: 3

=DROP(TEXTSPLIT(CONCAT(REPT(A1:A3&"|",B1:B3)),"|"),-1)

英文:

Try the following formula-

=DROP(TEXTSPLIT(CONCAT(REPT(A1:A3&"|",B1:B3)),,"|"),-1)

如何在Excel中重复文本?

答案2

得分: 2

这个帖子这个 帖子非常相似,几乎可以看作是重复的。唯一区别可能是你似乎想要按“z..a”的顺序排序(这在你的期望结果中并没有反映出来)。我在下面实现了这个:

如何在Excel中重复文本?

D1 单元格中的公式:

=SORT(XLOOKUP(SEQUENCE(SUM(B1:B3)),SCAN(0,B1:B3,LAMBDA(a,b,a+b)),A1:A3,,1),,-1)
英文:

This post and this one are very similar, if not a duplicate. Maybe the only thing that tells these apart is the fact that you seem to want a "z..a" order (which does not reflect in your desired result btw). I did implement it here below:

如何在Excel中重复文本?

Formula in D1:

=SORT(XLOOKUP(SEQUENCE(SUM(B1:B3)),SCAN(0,B1:B3,LAMBDA(a,b,a+b)),A1:A3,,1),,-1)

答案3

得分: 1

另一种解决方案 - 使用 MAKEARRAY

=LET(d,A1:B3,
m,MAKEARRAY(ROWS(d),MAX(INDEX(d,,2)),LAMBDA(r,c,IF(c<=INDEX(d,r,2),INDEX(d,r,1),#N/A))),
SORT(TOCOL(m,2),,-1))

我在最后添加了 SORT,因为您写道 "sort from Z to A by code"。

英文:

Another solution - using MAKEARRAY:

=LET(d,A1:B3,
m,MAKEARRAY(ROWS(d),MAX(INDEX(d,,2)),LAMBDA(r,c,IF(c&lt;=INDEX(d,r,2),INDEX(d,r,1),#N/A))),
SORT(TOCOL(m,2),,-1))

I added SORT at the end as you wrote "sort from Z to A by code"

huangapple
  • 本文由 发表于 2023年6月1日 14:00:26
  • 转载请务必保留本文链接:https://go.coder-hub.com/76379055.html
匿名

发表评论

匿名网友

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

确定