[英]how do I write a formula where the number portion of a cell reference comes from another cell?
In cell G14 I have the formula =MAX(D2:D14)
在单元格G14中,我有公式
=MAX(D2:D14)
I plan to copy this formula to all the cells in the column G. But, the formula needs to vary so that it is not always working against a fixed range. 我计划将此公式复制到G列中的所有单元格。但是,该公式需要更改,以便它并不总是在固定范围内工作。
What I want is something like: =MAX(D2:D(H14))
That would pull the number portion of the cell address from the cell to the right. 我想要的是这样的:
=MAX(D2:D(H14))
这样会将单元格地址中的数字部分从单元格拉到右侧。
To work against the volatile behavior of INDIRECT
most of the times solutions using INDEX
are also possible. 为了应对
INDIRECT
的不稳定行为,大多数时候使用INDEX
解决方案也是可能的。 So here too. 所以这里也是。
=MAX(D2:INDEX(D:D,H14))
About volatile behavior : Excel supports the concept of a volatile function, that is, one whose value cannot be assumed to be the same from one moment to the next even if none of its arguments (if it takes any) has changed. 关于易失性行为 :Excel支持易失性函数的概念,即,即使其所有参数(如果需要)都没有变化,也不能假定其值从一瞬间到下一瞬间都是相同的。 Excel reevaluates cells that contain volatile functions, together with all dependents, every time that it recalculates.
每次重新计算时,Excel都会重新评估包含易失函数以及所有依赖项的单元格。 For this reason, too much reliance on volatile functions can make recalculation times slow.
因此,过多地依赖于易失性函数会使重新计算时间变慢。 Use them sparingly.
谨慎使用它们。
=MAX(INDIRECT("D2:D" & H14))
will do it, assuming H14
contains the number. 假设
H14
包含数字,则=MAX(INDIRECT("D2:D" & H14))
将执行此操作。
But do note that using INDIRECT
makes the workbook volatile . 但是请注意,使用
INDIRECT
会使工作簿易变 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.