Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/google-sheets/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google sheets 谷歌电子表格数组公式与粘贴最佳实践_Google Sheets - Fatal编程技术网

Google sheets 谷歌电子表格数组公式与粘贴最佳实践

Google sheets 谷歌电子表格数组公式与粘贴最佳实践,google-sheets,Google Sheets,谷歌电子表格中数组公式的最佳实践问题 假设我在a列有一列值,在B列,我乘以10。我可以对整个范围使用数组公式,也可以在B列中创建第一个单独的公式并粘贴下来 我的问题是哪一个更好用?数组的计算速度快吗?从速度的角度看有什么好处吗?我有很大的电子表格,我想知道这是否会有所不同。我真的无法为这个答案提供任何参考,它是基于轶事证据和与其他Google Sheets用户的讨论 对于一个相对简单的计算,如您问题中的计算,我相信阵列解决方案对于非常大的数据集具有更好的性能。它还可以降低表格中公式限制的可能性(

谷歌电子表格中数组公式的最佳实践问题

假设我在a列有一列值,在B列,我乘以10。我可以对整个范围使用数组公式,也可以在B列中创建第一个单独的公式并粘贴下来


我的问题是哪一个更好用?数组的计算速度快吗?从速度的角度看有什么好处吗?我有很大的电子表格,我想知道这是否会有所不同。

我真的无法为这个答案提供任何参考,它是基于轶事证据和与其他Google Sheets用户的讨论

对于一个相对简单的计算,如您问题中的计算,我相信阵列解决方案对于非常大的数据集具有更好的性能。它还可以降低表格中公式限制的可能性(,但由数组公式填充的CONTINUE函数不影响此计数)


然而,对于非常复杂的计算,这两个选项实际上都能够使电子表格停止运行。这方面臭名昭著的例子是数组公式,我们需要求助于字符串操作(例如将数组连接在一起,然后再次拆分它们)。在本例中,我个人将使用plan C编写一个Google Apps脚本自定义函数,该函数将数组作为参数,使用纯Javascript操作数据,并输出一个数组。

您可以用两个脚本来测试这一点

乘以30000行,其中每个单元格为10乘以10

自动扩展大约需要0.275秒 复制时间约为0.678秒

抄袭

function CoppyDown() {
var ss    =SpreadsheetApp.getActive();
var sheet =ss.getSheetByName('AAA');
var LC    = sheet.getLastColumn();
var LR    = sheet.getLastRow();

var start = new Date();
//NON Auto-expanding Formula(s) to be added
//Two dim array with 1 row
var formulas = [["=A:A*10"]];

//Add NON auto-expanding formula(s) to Cell(s)
var cell = sheet.getRange(1,LC+1,1,formulas[0].length);
cell.setFormulas(formulas);
SpreadsheetApp.flush();

//Get range FULL Range of Cells W/Formulas
var r = sheet.getRange(1,LC+1,LR,formulas[0].length);

//Add formulas to Row1 Cell(s)
var cells = sheet.getRange(1,LC+1,1,formulas[0].length);
cells.setFormulas(formulas);

//Copy formulas down
cells.copyTo(r);
SpreadsheetApp.flush();

//Get the Display Values of the Range W/Formulas
//var v = r.getDisplayValues();

//Clear the Formulas Before the Postback
//This Super Speeds up the Postback
//r.clear();

//Postback Formulas as Values
//r.setValues(v);

var end = new Date();
var executiontime = end - start;
Logger.log(executiontime); 
}

非常有用。我不知道继续不参与4万人的统计。我在想我该如何绕过这个限制。如果你说的是真的,那么40k限制实际上是没有限制的。我所有的配方奶粉配额都被粘贴掉了。我没有从你的链接中看到任何关于这个的参考资料,但我希望你说的是真的。似乎你不能数组一个vlookup,嗯?关于数组vlookup:关于我们如何知道CONTINUE异常,是的,我也不知道有什么参考文献,在同一个谷歌文档论坛上,人们发现情况就是这样。这里有一个复杂的问题,没有数组的公式更受欢迎。所以我把数组公式放进去了。现在我正在运行一个脚本,对我的范围进行排序。但是,在对范围进行排序之后,所有数组公式都表示需要按ctrl+shift+e来显示其余的输出。似乎其他人也有同样的问题。同样在这里,在对数组公式有了更多的经验之后,它的好处似乎是它们是经得起未来考验的(即,当您添加更多单元格时,数组公式会自动添加continue函数),但如果没有数组公式,电子表格的运行速度似乎要快得多。也许每次值更改时,数组公式都必须重新计算该数组中的所有内容?与粘贴的单个公式相比,只需重新计算任何已更改的内容?我希望谷歌的人能对此发表评论。
function CoppyDown() {
var ss    =SpreadsheetApp.getActive();
var sheet =ss.getSheetByName('AAA');
var LC    = sheet.getLastColumn();
var LR    = sheet.getLastRow();

var start = new Date();
//NON Auto-expanding Formula(s) to be added
//Two dim array with 1 row
var formulas = [["=A:A*10"]];

//Add NON auto-expanding formula(s) to Cell(s)
var cell = sheet.getRange(1,LC+1,1,formulas[0].length);
cell.setFormulas(formulas);
SpreadsheetApp.flush();

//Get range FULL Range of Cells W/Formulas
var r = sheet.getRange(1,LC+1,LR,formulas[0].length);

//Add formulas to Row1 Cell(s)
var cells = sheet.getRange(1,LC+1,1,formulas[0].length);
cells.setFormulas(formulas);

//Copy formulas down
cells.copyTo(r);
SpreadsheetApp.flush();

//Get the Display Values of the Range W/Formulas
//var v = r.getDisplayValues();

//Clear the Formulas Before the Postback
//This Super Speeds up the Postback
//r.clear();

//Postback Formulas as Values
//r.setValues(v);

var end = new Date();
var executiontime = end - start;
Logger.log(executiontime); 
}