I have not found division of real numbers (ie, /
) in worksheet functions. As a consequence, to evaluate =SUM(2,SUM(30,40)/3)
, we cannot use one expression ctx.workbook.functions.sum(1,ctx.workbook.functions.sum(30,40)/3)
;
we have to do ctx.sync
two times:
function test () {
Excel.run(function (ctx) {
var result = ctx.workbook.functions.sum(30,40);
var result2;
result.load();
return ctx.sync()
.then(function () {
result2 = ctx.workbook.functions.sum(1,result.value/3);
result2.load(); })
.then(ctx.sync)
.then(function () {
console.log(result2.value); });
});
}
That means, if there are several /
in one expression, we have to use even more ctx.sync
to evaluate it, which is very tedious (and especially hard to be automatically constructed).
So it would be really great to either find the worksheet function or a workaround for /
, so that we could still evaluate an expression containing /
in one step.
PS: it seems that there is no worksheet function for +
, *
, -
either, but we could use workarounds: sum
for +
, product
for *
, and sum(..., product(-1, ...)
for -
.