繁体   English   中英

excel和javascript的结果公式不同

[英]Result formula from excel and javascript is different

我有总penumpang的excel公式

=SUM(D1:D2)-SUM(A3:C3)+C4 and have result 29 when i tried input specific value

然后我尝试了 javascript

 document.getElementById('totalpnp4').value = parseInt(d1)+parseInt(d2)-parseInt(a3)+parseInt(b3)+parseInt(c3)+parseInt(C4); and have result 34 when i tried input same value at excel

那么,如何使 javascript 具有与 excel 函数相同的结果值? 谢谢

使用括号对值进行分组:

document.getElementById('totalpnp4').value = (parseInt(d1)+parseInt(d2))-(parseInt(a3)+parseInt(b3)+parseInt(c3))+parseInt(C4);

求和 a3+b3+c3,然后从之前的总和中减去它。

暂无
暂无

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

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