eval function in google spreadsheet; multi rows

in #eval7 years ago (edited)

Google spreadsheet does not serve 'eval' function.

User write custom function like:

function myEval(s) {
return eval( s)
}​

But, it cannot use multi rows.

If you want apply multi rows one time, you can take below:

function doEval( formula ) {
if (typeof formula.map === "function") {
return formula.map(doEval);
}else if(formula){
return eval(formula);
}
}

doEval.jpg

Let me see AA1 cells value:

=IFERROR(ARRAYFORMULA(vlookup(C$1:C,'CODE'!$J$2:$K$3,2,false)),0)

Condition C is 1 : A (in this case A is 1.1*0.04)
Condition C is 2 : B

code.jpg

  • We modify this formula sometimes.

ARRAYFORMULA function is wonderful for multi rows.

When you use google forms, you can it.

You need statistic function to treat repeated copied and pasted cells values for google forms results.

Please question comfortable.

apply.jpg

Refer to custom function writing
https://steemit.com/spreadsheet/@zero6pak/date-time-replacement-in-ifttt-with-google-script