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

前端 未结 2 1676
没有蜡笔的小新
没有蜡笔的小新 2021-01-19 05:25

I want to populate some values in a sheet and then use jxl Formula to get the values from that sheet and write it to another sheet...

When I try to run this sample c

2条回答
  •  一整个雨季
    2021-01-19 06:04

    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)");
    

提交回复
热议问题