Reputation: 1680
I have the formula in the excel sheet like
=IF($F6=0,"",IF(I6=0,"",$F6/I6))
where F6=7000; I6="";
The excel result is showing no data for the Formula, now in javascript I need to convert.
function AB6(F6)
{
var AB6="";
if(F6==0)
AB6='data';
alert("Data: "+AB6);
if(I6==0)
{
AB6="";
AB6=F6/I6;
alert(AB6);
}
return AB6;
}
is this a right function in javascript for the below formula.
Upvotes: 0
Views: 10784
Reputation: 875
No. The I6 comparison in excel is only executed when the F6 comparison failed. Even more, there is never an else
part in your javascript...
This is the javascript equivalent:
if (F6 == 0) {
AB6="";
} else {
if (I6 == 0) {
AB6 = "";
} else {
AB6 = F6/I6;
}
}
Upvotes: 2