excel输入公式不计算
What happens when good Excel formulas go bad? A workbook of mine that worked fine for several years, when using Excel 2003, suddenly refused to update all the formulas, after a switch to Excel 2010. Even more mysterious, the calculations worked fine on some machines, but not others. Why are Excel formulas not calculating on some computers?
好的Excel公式变坏会怎样? 我的一个工作簿在使用Excel 2003时可以正常工作数年,但是在切换到Excel 2010之后突然拒绝更新所有公式。更神秘的是,这些计算在某些计算机上可以正常工作,但在其他计算机上却可以。 为什么某些计算机上无法计算Excel公式?
Hint: It wasn't one of the obvious solutions.
提示:这不是显而易见的解决方案之一。
检查自动计算 (Check for Automatic Calculation)
When someone complains about Excel formulas not calculating , it's usually because the Calculation setting has been changed to Manual, instead of Automatic.
当有人抱怨Excel公式没有计算时,通常是因为“ 计算”设置已更改为“手动” ,而不是“自动”。
That can happen if the first workbook that you open in an Excel session was saved as Manual calculation. That setting affects all the other workbooks the you open during that session.
如果您在Excel会话中打开的第一个工作簿被保存为“手动计算”,则会发生这种情况。 该设置会影响您在该会话期间打开的所有其他工作簿。
In this case, the workbook calculation was set to Automatic on all the machines – that's the first thing we checked.
在这种情况下,工作簿计算在所有计算机上都设置为“自动” –这是我们检查的第一件事。
To check the setting, click the Formulas tab on the Excel Ribbon, and click the Calculate Options drop down.
要检查设置,请单击Excel功能区上的“公式”选项卡,然后单击“计算选项”下拉菜单。
![formulacalculate00 formulacalculate00](https://i-blog.csdnimg.cn/blog_migrate/cc14aa0d54fccf84ef0d669be971f2cc.png)
Or, go to the Excel Options window, and click Formulas.
或者,转到“ Excel选项”窗口,然后单击“公式”。
![formulacalculate01 formulacalculate01](https://i-blog.csdnimg.cn/blog_migrate/d37a967320121efb691764d21ebc93d7.png)
强制计算 (Force the Calculation)
Even if the Calculation option is set for Manual, you can use a Ribbon command or keyboard shortcut to force a calculation.
即使将“计算”选项设置为“手动”,您也可以使用功能区命令或键盘快捷键来强制执行计算。
Click the Formulas tab on the Excel Ribbon, and click Calculate Now or Calculate Sheet.
单击Excel功能区上的“公式”选项卡,然后单击“立即计算”或“计算工作表”。
n the tooltip that is shown in the screen shot below, you can see that the shortcut for Calculate Sheet is Shift + F9.
在下面的屏幕快照中显示的工具提示中,您可以看到Calculate Sheet的快捷方式是Shift + F9 。
![formulacalculate03 formulacalculate03](https://i-blog.csdnimg.cn/blog_migrate/f914528e1cbc1404a09871faabe550d2.png)
We tried using the Calculation shortcuts, including Ctrl + Alt + Shift + F9 (that one recalculates everything, and starts your car).
我们尝试使用“计算”快捷方式,包括Ctrl + Alt + Shift + F9 (可以重新计算所有内容,然后启动您的汽车)。
![formulacalculate04 formulacalculate04](https://i-blog.csdnimg.cn/blog_migrate/3244f018aec25247927c76704aa03076.png)
However, none of the shortcuts had any effect on the non-calculating cells in this workbook. I also tried a macro that did a full calculation, and that didn't work either. Sigh.
但是,快捷方式都没有对本工作簿中的非计算单元产生任何影响。 我还尝试了一个可以进行完整计算的宏,但是它也不起作用。 叹。
用VBA启动公式 (Kick Start the Formulas with VBA)
Next I wrote a macro that replaced all the "=" signs at the start of all formulas in the workbook. This has a similar effect to manually selecting a cell, clicking in formula bar and pressing the Enter key, to recalculate the cell.
接下来,我写了一个宏,替换了工作簿中所有公式开头的所有“ =”符号。 这与手动选择一个单元格,单击公式栏并按Enter键以重新计算该单元格具有相似的效果。
![formulacalculate05 formulacalculate05](https://i-blog.csdnimg.cn/blog_migrate/2ad7cc9ae4efd0371cfcd015609959a1.png)
Sometimes that brings a tired formula back to life, but not in this case. These formulas weren't sleeping, they were deceased!
有时,这会使疲惫的配方恢复生机,但在这种情况下不会。 这些配方没睡着,已经死了!
更改公式中的命名范围 (Change the Named Range in the Formula)
I spent a considerable amount of time in Google, looking for other suggestions, but didn't find anything new. So, I kept tweaking and testing, going through the file one worksheet at a time.
我在Google上花费了大量时间,寻找其他建议,但没有发现任何新内容。 因此,我不断进行调整和测试,一次浏览一个文件。
Finally, I found the formulas that seemed to be causing the problem. They were SUMIF formulas that referred to a named range on another worksheet.
最后,我发现了似乎引起问题的公式。 它们是SUMIF公式 ,引用了另一个工作表上的命名范围。
=IF(B7="",0,SUMIF(DataEntryStep2a,E7,$D$7:$D$22))
= IF(B7 =“”,0,SUMIF( DataEntryStep2a ,E7,$ D $ 7:$ D $ 22))
There was no obvious reason why that wouldn't work in Excel 2010, but I was getting desperate. So, I changed the named range to a worksheet reference, using cells on the same worksheet.
没有明显的原因为什么这在Excel 2010中不起作用,但我感到绝望。 因此,我使用同一工作表上的单元格将命名范围更改为工作表引用。
=IF(B7="",0,SUMIF($E$7:$E$22,E7,$D$7:$D$22))
= IF(B7 =“”,0,SUMIF( $ E $ 7:$ E $ 22 ,E7,$ D $ 7:$ D $ 22))
Miraculously, that solved the problem! I held my breath, while we tested on a few more machines, and everything calculated as it was supposed to.
奇迹般地解决了问题! 我屏住呼吸,在更多的机器上进行测试时,一切都按预期进行了计算。
Why that worked, I have no idea, but if you run into a similar problem, maybe it will help you too. Of course, this solution could stop working again, at the next lunar eclipse!
为什么不行,我不知道,但是如果您遇到类似的问题,也许对您也有帮助。 当然,在下一个月食时,此解决方案可能会再次停止工作!
[Update] There is problem with SUMIF, SUMIFS, AVERAGEIF and AVERAGEIFS, in Excel 2010, when the references are on a different sheet. Thanks to Stuart Valentine, who posted a link to a discussion of this SUMIFS problem. My named range was on a different sheet, so the location was the problem.
[更新]当引用位于不同的工作表上时,Excel 2010中的SUMIF,SUMIFS,AVERAGEIF和AVERAGEIFS出现问题。 感谢Stuart Valentine,他发布了有关此SUMIFS问题的讨论的链接。 我的命名范围在另一张纸上,所以位置是问题所在。
观看视频 (Watch the Video)
In most cases though, the problem is the Automatic Calculation setting.
但是,在大多数情况下,问题是“自动计算”设置。
To see the effects of opening Excel workbooks with different calculation option settings, watch this short Excel tutorial video.
若要查看使用不同的计算选项设置打开Excel工作簿的效果,请观看此简短的Excel教程视频。
翻译自: https://contexturesblog.com/archives/2012/02/16/excel-formulas-not-calculating/
excel输入公式不计算