Handsontable 公式#VALUE!错误,即使单元格的公式是正确的

Posted

技术标签:

【中文标题】Handsontable 公式#VALUE!错误,即使单元格的公式是正确的【英文标题】:Handsontable formula #VALUE! error even the formula for the cell is correct 【发布时间】:2018-04-29 20:53:34 【问题描述】:

即使公式正确,Handsontable 也会抛出 #VALUE 错误。

要了解我的问题,请将此示例中的 var data1 http://jsfiddle.net/qfpfxgw5/ 替换为以下数据。

var data1 =
[
["","","","","","","","","",""],
["","","","","","","","","",""],
["","","","","","","","","",""],
["","","","","","","","","",""],
["","","","","","","","","",""],
["","","","","","","","","",""],
["","","","","","","","","",""],
["","","","","","","","","",""],
["","","=C13-C14","=D13-D14","=E13-E14","=F13-F14","=G13-G14","=H13-H14","=I13-I14","=SUM(C9:I9)"],
["","","985149",21651,35565,985149,548,312495,35195,"=SUM(C10:I10)"],
["","",3563546,35635,35635,75345,54245,723445,53577,"=SUM(C11:I11)"],
["","",0,0,35565,0,0,312495,0,"=SUM(C12:I12)"],
["","",3563546,35635,"=D13+E10+E12","=E13+F10+F12","=G12+G10+F13","=H12+H10+G13","=I12+I10+H13","=SUM(C13:I13)"],
["","",3563546,35635,"=D14+E11","=E14+F11","=F14+G11","=G14+H11","=H14+I11","=SUM(C14:I14)"],
["","",50,50,50,50,50,50,50,"=SUM(C15:I15)"],
["","",3550,3550,3621,4800,3550,3550,3300,"=SUM(C16:I16)"],
["","",8,8,8,8,8,8,8,"=SUM(C17:I17)"]
];

然后跑。

您会看到#VALUE! E9、F9 等错误。

我们有

E9=E13-E14;  
E13=D13+E10+E12;  and
E14=D14+E11

为什么在我再次重置 E9=E13-E14 的值之前它没有给出预期的输出。解决它的另一种解决方案应该是什么? 提前致谢。

【问题讨论】:

【参考方案1】:

我假设是因为这些单元格也附有公式。所以由于某种原因 if 没有渲染。

解决方案?,不确定,我尝试从其他单元格中获取一个带有公式的单元格,看看是否可能一旦它们呈现,下面的单元格就可以工作,但它没有。

编辑:我实际上正在研究类似的东西并想出了一个不太好的解决方案:

http://jsfiddle.net/qfpfxgw5/2/

基本上,如果您从一个单元格中引用一个值,该单元格也有一个与之关联的函数,它将不起作用。

因此,要使其正常工作,您必须在当前单元格的公式中包含来自该其他单元格的实际公式。

示例:

cellA13: = E13-E14
cellE13: = SUM(B2,B3)
cellE14: = 100

这不起作用,但如果你把它改成这样:

cellA13: =SUM((SUM(B2,B3))-E14)
cellE13: =SUM(B2,B3)
cellE14: =100

我上面的例子做了类似的事情,并且成功了。

丑陋...但我不知道如何使它工作。

【讨论】:

您找到解决方案了吗?尽管它可能很丑陋,但它确实有效,我目前不知道该问题的任何其他解决方法。

以上是关于Handsontable 公式#VALUE!错误,即使单元格的公式是正确的的主要内容,如果未能解决你的问题,请参考以下文章

Meteor 错误,未定义 Handsontable

Handsontable 更新公式变量

Handsontable 和热公式解析器

请问,jQuery Handsontable控件如何像excel一样,设置公式,让某个单元格的值自动算出来?

为啥 Sumproduct 公式显示 #Value 错误?

Handsontable:jquery 合并标题,水平滚动错误