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.
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.
Share Improve this question asked Oct 23, 2013 at 11:43 NavyahNavyah 1,68011 gold badges33 silver badges59 bronze badges 3- 1 Please don't write in ALL CAPS, it's hard to read. – user9876 Commented Oct 23, 2013 at 11:45
- 1 there are lot of converters available. Make use of them.excelformulabeautifier. – The Hungry Dictator Commented Oct 23, 2013 at 11:48
- I dont want a conevrt if just giving if condition, i want result for that if condition – Navyah Commented Oct 23, 2013 at 11:58
1 Answer
Reset to default 2No. The I6 parison in excel is only executed when the F6 parison 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;
}
}