Excel Evaluate formula error

╄→гoц情女王★ 提交于 2019-12-06 10:23:43

Interesting problem... For further insight into the issue try these from the immediate or watch window:

?[indirect("rc",0)]
?[index(a:a,row())]
?[offset(a1,row()-1,column()-1)]

Strangely they all evaluate to A1 no matter which cell is active. It's a quirk of Evaluate or [] that references are treated relative to A1 instead of the active (calling) cell when the return value is a range reference. You can think of row() as equivalent to row(RC) in RC-notation evaluated relative to A1.

However, note that changing ] to &""] in the three formulas above results in an error in the first but the expected result in the last two so that row() is now evaluated relative to the active cell. So it seems that Evaluate is functioning differently when the return value is not a range reference.

Update

Based on these observations you can use INDEX for the row reference and move INDIRECT outside:

Sheet1!F4:=INDIRECT(yEval(Sheet2!E19))
Sheet2!E19:"pries!"&Sheet2!I19&INDEX(Sheet1!D:D,Row())

...or just use RC-style references without the need for the UDF:

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