简体   繁体   English

为什么我的 Google 表格公式不会自动重新计算?

[英]Why does my Google Sheets formula not automatically recalculate?

I have this formula in a cell in a 'Summary' sheet which is waiting for a new sheet to be created with its name being a date:我在“摘要”工作表的单元格中有这个公式,它正在等待创建一个名称为日期的新工作表:

=IFERROR(VLOOKUP($A3, INDIRECT("'"&TEXT(BN$2,"m/d/yyyy")&"'!$E$6:$o$100"), 11, false), "")

However, when I add the new sheet with the name that would match, then it doesn't automatically recalculate and pull in the values from the new sheet.但是,当我添加名称匹配的新工作表时,它不会自动重新计算并从新工作表中提取值。

The weird thing is if I add a column to the left of this column that has the formula shown above, then it recalculates ... and all is well.奇怪的是,如果我在此列的左侧添加一列具有上述公式的列,那么它会重新计算......一切都很好。 Another weird thing is if I add a column far enough away from the column in question then it doesn't recalculate in the same way that it does when I add a column near the column in question (hmmmm....).另一个奇怪的事情是,如果我添加一列离相关列足够远,那么它不会像我在相关列附近添加一列时那样重新计算(嗯......)。

What is going on here?这里发生了什么? And how can I work around it?我该如何解决它? Seems Google has some major bugs around this area or something ...似乎谷歌在这方面有一些主要的错误或什么......

  • This is due to INDIRECT .这是由于INDIRECT

  • A partial workaround:部分解决方法:

     =IFERROR(INDIRECT("'"&C9&"'!A1"),RAND())
  • Use this instead of just INDIRECT in your formula.在您的公式中使用它而不是仅使用INDIRECT It still won't update on opening and closing.它仍然不会在打开和关闭时更新。 But it'll update, Whenever there's a edit anywhere in the sheet (making this a double volatile combo with RAND() ).但它会更新,只要在工作表中的任何地方进行编辑(使其成为RAND()的双重易失性组合)。

  • Also, Try turning on recalculations every 6 hours or so in spreadsheet settings.此外,尝试在电子表格设置中每 6 小时左右打开一次重新计算。

PS: Your Spreadsheet might burn🔥🔥 due to the heavy volatility. PS:由于剧烈波动,您的电子表格可能会燃烧🔥🔥。

Sorry for the late response, but I believe I have a solution that works a little better.抱歉回复晚了,但我相信我有一个更好的解决方案。 I was experiencing the same problem with formulas involving almost exactly the same set of formulas.我在涉及几乎完全相同的一组公式的公式中遇到了同样的问题。

Basically, just add in a check to see if now() equals an impossible time (0), and when it fails (every time), have it execute the formula that won't update on its own.基本上,只需添加一个检查以查看 now() 是否等于不可能的时间 (0),并且当它失败时(每次),让它执行不会自行更新的公式。

=IF(NOW()=0,"",
IFERROR(VLOOKUP($A3, INDIRECT("'"&TEXT(BN$2,"m/d/yyyy")&"'!$E$6:$o$100"), 11, false), "")
)

based on idea similar to TheMaster I defined a named range refresh and refered to it in the else portion of the IFERROR formula.基于类似于 TheMaster 的想法,我定义了一个命名范围refresh并在IFERROR公式的else部分引用了它。 Whenever I create a new sheet, rename an existing one, or feel the need to make sure all indirects are updated I simply edit the content of refresh , and put it back to blank.每当我创建新工作表、重命名现有工作表或需要确保更新所有indirects ,我只需编辑refresh的内容,然后将其放回空白。

=arrayformula(iferror(indirect(B11&"!D42:H42");refresh))

I used Berteh's idea, but found that putting the refresh range within the else portion of the iferror removed the benefit of having a way to have a blank cell if there is no value, or what ever else you'd want to use the else for.我使用了 Berteh 的想法,但发现将refresh范围放在iferrorelse部分消除了在没有值的情况下有一个空白单元格的方法的好处,或者你想用else做什么.

So, to maintain that, I put this together which seems gets us the benefit of preserving the benefit of using iferror and forcing the indirect to update.因此,为了保持这一点,我将它们放在一起,这似乎使我们受益于保留使用iferror并强制indirect更新的好处。

=IF(refresh!$A$1=1,IFERROR(VLOOKUP($B68,INDIRECT(D$66&"A1:aa2000"),8,0),""))

Updating the value of the refresh range will force a recalculation (I change the value of cell A1 from 1 to a 0 and then back to 1).更新refresh范围的值将强制重新计算(我将单元格 A1 的值从 1 更改为 0,然后再更改回 1)。 I've implemented this on multiple rows across multiple sheets and not found this to blow up the Google Sheet.我已经在多张工作表的多行上实现了这一点,但没有发现这会炸毁 Google 表格。

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

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