遇到問題得到一致的結果,希望能爲一些指針試圖解決這個自己撞牆Excel公式爲Javascript,工作,但不一致
Excel公式:
=IF(C15=""," ",IF(D15="O"(((ROUNDUP(((C15+0.625)/(6.25-0.5)),0)*6.25))+4.125+0.5),IF(D15="t",C15,"ERROR")))
C15= 100.00
邏輯測試..
D15="O"
第二次邏輯測試,驗證100.00可以擴展到該數字的預定結果... if D15="t"
因爲被困住了,它停留在100.00
.... 我可以用「如果其他」後來,還在學習
<html>
<head>
<title>Excel Formula to JavaScript</title>
</head>
<body>
<script type="text/javascript">
var num1 = 170.00;
var acc1 = (num1 + 0.625)/(6.25-0.50);
var acc2 = Math.round((acc1 * 10)/10) * 6.25 + (4.125 + 0.50);
document.write(acc2).toFixed(3);
</script>
<div>
<br>
num1= 30.00 result should be 42.125".... incorrect result!
<br>
<br>
num1= 40.00 result should be 54.625".... incorrect result!
<br>
<br>
num1= 57.00 result should be 73.365".... incorrect result!
<br>
<br>
num1= 85.00 result should be 98.375"... result correct
<br>
<br>
when num1= 100.00 result should be 117.125"... result correct
<br>
<br>
seems any input under 77 result will be incorrect
</div>
</body>
</html>
尼斯開心快樂,math.ceil解決方案工作,每次測試的完美!謝謝 – bigdog