如何在 Google SpreadSheet 中使范围重复 n 次 [英] How to make a range repeat n-times in Google SpreadSheet

查看:17
本文介绍了如何在 Google SpreadSheet 中使范围重复 n 次的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 ArrayFormula() 来简化我创建报告的方式.

I use ArrayFormula() to simplify the way I create my reports.

不必在每个单元格中创建引用(例如 =C1,=C2,=C3,=C4 在每个单元格中,我只在一个单元格中使用 =arrayformula(C1:C4).它做完全相同的工作,但更简单,它使事情更有条理,因为我只需要在一个单元格中查找可能的错误.

Instead of having to create a reference in each cell (eg. =C1,=C2,=C3,=C4 in each cell, I just use =arrayformula(C1:C4) in one single cell. It does exactly same job, but is much simpler and it keeps things more organized, because I just need to look in one cell for possible errors.

当我必须将一个范围引用到另一个范围时,例如将 C1:C4 的值带入 A1:A4 范围时,它非常有效.在 A1 单元格中,我只需要写 =arrayformula(C1:C4) 就可以了.

It works great when I have to reference a range into another like take the values of C1:C4 into the A1:A4 range. In the A1 cell I would just write =arrayformula(C1:C4) and it does its magic.

当范围的长度不同时,它确实会变得有点棘手,但它仍然是可行的.例如,如果我想在 B1:B3 的顶部堆叠两个或多个范围链接 C1:C4,在单元格 A1 上我可以写 =arrayformula({C1:C4;B1:B3}).

It does get a bit trickier when the ranges are not the same length, but it is feasible nonetheless. For instance, if I want to stack two or more range link C1:C4 on top of B1:B3, on cell A1 I can write =arrayformula({C1:C4;B1:B3}).

我的问题是使用 arrayFormula() 复制重复模式.例如,如果我想复制单元格 C1 的内容 4 次,我会使用 =arrayformula({C1;C1;C1;C1}).

My problem is using arrayFormula() to copy a repeating pattern. For instance, if I want to copy the content of cell C1 4 times I would use =arrayformula({C1;C1;C1;C1}).

这会起作用并达到预期的效果.但是,我想知道是否有更好的方法来做到这一点.像 =arrayformula({C1}*12) 这样的模式会重复 12 次.这也将使我能够拥有一个动态公式,例如 =arrayformula({C1}*count(D:D)) 其中模式将根据某个变量重复.

This would work and would achieve the desired effect. However, I was wondering if there is a better way to do that. Something like =arrayformula({C1}*12) were this pattern would repeat 12 times. This would also enable me to have a dynamic formula, such as =arrayformula({C1}*count(D:D)) where the pattern would repeat according to some variable.

您对如何仅使用本机公式(无 javascript)实现这一目标有任何想法吗?

Do you have any ideia on how to achieve that using only native formula (no javascript)?

推荐答案

对于N行M列的字符串text:

For N rows and M columns of string text:

=ARRAYFORMULA("text"&T(SEQUENCE(N_rows,M_columns)))

对于 N 行 M 列的数字 123:

For N rows and M columns of number 123:

=ARRAYFORMULA(123+0*SEQUENCE(N_rows,M_columns))

这篇关于如何在 Google SpreadSheet 中使范围重复 n 次的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆