简体   繁体   English

如何编写公式,其中单元格引用的数字部分来自另一个单元格?

[英]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.

相关问题 如何通过引用复制单元格公式(或评估单元格公式)? - How do I copy a cell formula by reference (or evaluate a cell formula)? 如何从另一个单元格引用单元格引用(这会导致另一个工作表单元格引用) - How do I reference a cell reference from another cell (which leads to another worksheet cell reference) EXCEL-如何查找具有特定内容的单元格,然后在另一个公式中引用该CELL(而不是其内容)? (内例) - EXCEL - How do I find a cell with specific content, and then reference that CELL (not its content) in another formula? (example within) Excel:从另一个添加行的工作表的单元格中引用一个公式 - Excel: Reference a formula in a cell from another worksheet where rows are added 如何使用公式中的ID引用另一个Excel工作表中的单元格 - how to reference a cell in another excel worksheet using ID from a formula 从另一个单元格中的一个数字减去一个单元格中的数字范围的公式 - Formula for subtracting number range in one cell from a number in another cell 如何在距离我所在的单元格X列的单元格中写入(X是在另一个单元格中定义的值) - How can I write in a cell that is X number of column away from the cell I am on (X is a value defined in another cell) 如何验证细胞的一部分? - How do I validate a portion of a cell? 公式中的单元格编号 - Cell number from formula 如何使用VBA添加引用另一个单元格的公式? - How do I add a formula with VBA that refers to another cell?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM