如何阻止Excel改变细胞内的公式?

发布于 2025-01-20 03:50:50 字数 317 浏览 0 评论 0原文

我有这个公式 =IFERROR(VLOOKUP("实际/估计船舶单位预测",'WD ALPS'!$A:$K,MATCH(Date1,'WD ALPS'!$A$651:$K$651,0),FALSE) ,“”) 每次我运行宏来重新提取此公式中引用的数据时,Excel 都会将范围更改为 1。 (这打乱了我所有的计算。) 所以我从 MATCH(Date1,'WD ALPS'!$A$651:$K$651,0)MATCH(Date1,'WD ALPS'!$A$650:$K$650 ,0) 无缘无故。我希望无论数据表发生什么情况它都保持不变。

I have this formula
=IFERROR(VLOOKUP("Actual/Estimated Ship Units Forecast",'WD ALPS'!$A:$K,MATCH(Date1,'WD ALPS'!$A$651:$K$651,0),FALSE),"")
Each time I run a macro to re-pull the data referenced in this formula, excel changes the range by one. (which messes up all of my calculations.)
So I go from MATCH(Date1,'WD ALPS'!$A$651:$K$651,0) to MATCH(Date1,'WD ALPS'!$A$650:$K$650,0)
without reason. I want it to stay constant no matter what happens to the data sheet.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

独行侠 2025-01-27 03:50:50

一种可能性是使用偏移。这是一个挥发性的功能,可能导致响应时间问题,但在小规模上,通常不是问题。

您将偏移量锁定到一个不会因运行的宏而不会更改的锚单元。在这种情况下,我将假设A1受到影响。您可以将您的公式更改为:

MATCH(Date1,OFFSET('WD ALPS'!$A$1,650,0):OFFSET('WD ALPS'!$A$1,650,10),0)

另一种不会挥发的方式,并且对锚的依赖性不依赖于以相同的方式使用索引:

MATCH(Date1,INDEX('WD ALPS'!$1:$1048576,651,1):INDEX('WD ALPS'!$1:$1048576,651,11),0)

这选择了整个纸,然后用绝对的方法切出您想要的零件,固定索引。不足的一面是它评估了整个表格 - 我不确定哪个会更快。

One possibility is to use OFFSET. This is a volatile function, which may result in response time issues, but at a small scale, it is usually not an issue.

You would lock the OFFSET to an anchor cell that is not changed by the macro that you run. In this case, I will assume A1 is not impacted. You could change your formula to:

MATCH(Date1,OFFSET('WD ALPS'!$A$1,650,0):OFFSET('WD ALPS'!$A$1,650,10),0)

Another way that would not be volatile and would not have a dependency on an anchor would be to use INDEX in the same way:

MATCH(Date1,INDEX('WD ALPS'!$1:$1048576,651,1):INDEX('WD ALPS'!$1:$1048576,651,11),0)

This selects the whole sheet and then cuts out the piece that you want with absolute, fixed indices. The down side is that it evaluates the whole sheet - I am not sure which would run faster.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文