Problem when using JXL Formula like SUM() AVG() STDEV() returns #VALUE! when it refers values from another sheet

烈酒焚心 提交于 2019-12-01 18:51:00

It looks like excel is evaluating the formula in a strange way, hence why you are seeing #VALUE!. To see why the formula is failing, click on the formula cell and then go to Tools > Formula Auditing > Evaluate Formula. You will see that the steps are:

AVERAGE(Output!D1:Output!D5)
=AVERAGE(5:Output!D5)
=AVERAGE(5:1)
=AVERAGE(#VALUE!)
=#VALUE!

But when you execute F2+Enter on the cell, you will see that Excel changes its execution plan and gets the right answer.

I'm afraid the only thing I can think of to fix this is to use a comma-separated list, instead of a range:

Formula formula = new Formula(3,5, "AVERAGE(Output!D1,Output!D2,Output!D3,Output!D4,Output!D5)");

You can fix this problem if you put in e.g. Z1 = "=Output!D1", Z2 = "=Output!D2"... and later you try AVERAGE(z1:z5) in your favorite cell

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!