简体   繁体   中英

Simple excel formula equivalent

I have a simple excel formula I am trying to replicate in javascript but am a newbie and can't seem to get it to work!

Excel Formula:

=((D6*D7)/3.6)+(D7*D7)/(254*(D8+0.01*D9))

Java Script:

= (D6 * D7) / 3.6 + (D7 * D7) / (254 * (D8 + 0.01 * D9));

I appreciate any advice.

you should define the value of D6, D7, D8 and D9 at first, like:

var D6 = 3;
var D7 = 5;
var D8 = 9;
var D9 = 10;

var result = (D6 * D7) / 3.6 + (D7 * D7) / (254 * (D8 + 0.01 * D9)); 

Thanks Justin,
I already had the variables defined, I was just questioning the formula. After trial and error I found that the D8 addition was causing the problem. The final successful outcome was:
= ((D6 * D7) / 3.6) + (D7 * D7) / (254 * (0.01 * D9 + +D8))

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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