简体   繁体   English

基于时间的冻结功能(GAS或检测功能)

[英]Freezing Functions based on time (GAS or Detault Functions)

I'm trying to find a way to execute a formula at a specific time and then lock it, without changing. 我试图找到一种在特定时间执行公式然后锁定它而不进行更改的方法。

Essentially, I am counting responses for different people (from the output of a google form). 实质上,我是在计算针对不同人的回复(来自google表单的输出)。 Each week, the google form is wiped. 每周都会清除Google表单。 However, I want to keep the record of how many times said persons name came up in the last 8 weeks. 但是,我想记录一下最近8周内有多少人说过姓名。

Right now, I simply use a COUNTIF() function and manually tally the results. 现在,我只使用COUNTIF()函数并手动计算结果。 I'd like to improve this system and switch over to some way where it is kept in different cells/sheets, and then once the end of the week hits that COUNTIF would just print the absolute value of it's result and freeze. 我想改进此系统,并切换到某种方式,将其保存在不同的单元格/工作表中,然后在一周中点击一次时,COUNTIF将只打印其结果的绝对值并冻结。

I'd be ok to do this using Google Apps Script if necessary as I have some proficiency with that. 如果有必要,我可以使用Google Apps脚本来做到这一点,因为我对此有所了解。 In the interest of time though, using some kind of built in Google Sheets method is preferable. 不过,为了节省时间,最好使用某种内置的Google表格方法。

Please let me know if this has been done or if there are ways to get this done (I'm sure it's doable, not sure how). 请让我知道是否已完成此操作,或者是否有方法可以完成此操作(我确定它是可行的,但不确定如何操作)。

The calculation of formulas at an specific time and then "freeze" the result depends on the characteristics of the formulas 在特定时间计算公式,然后“冻结”结果取决于公式的特征

Cases 案例

  1. custom function with static arguments 具有静态参数的自定义函数
    Add a dummy argument that should be changed at the time that the custom function should be recalculated. 添加一个虚拟参数,该参数应在重新计算自定义函数时更改。 Since custom functions can't use volatile functions as arguments, a time-driver trigger should change the dummy argument at the desired time. 由于自定义函数不能将易失函数用作参数,因此时间驱动器触发器应在所需时间更改虚拟参数。
  2. built-in functions with or without custom functions 具有或不具有自定义功能的内置功能
    Use a time-driven trigger that adds the formula wait for the spreadsheet recalculation finish and then replace the formula by it's result. 使用时间驱动的触发器,该触发器添加公式以等待电子表格重新计算完成,然后将其替换为公式的结果。

Bear in mind that time-driven triggers will not run at very precise times. 请记住,时间驱动的触发器不会在非常精确的时间运行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM