英文:
How to repeat text in excel?
问题
我想请教您的建议。我在这个问题上遇到了困难
我尝试在Excel中使用REPT函数,但结果显示所有复制的单词都在一个单元格中。我应该如何改进它?
我希望结果像这样
并按代码从Z到A排序。我该如何做呢?非常感谢。
英文:
I would like to ask for your advices. I have a problem with this
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
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)
答案2
得分: 2
这个帖子 和 这个 帖子非常相似,几乎可以看作是重复的。唯一区别可能是你似乎想要按“z..a”的顺序排序(这在你的期望结果中并没有反映出来)。我在下面实现了这个:
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:
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<=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"
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论