在 Excel 中重复嵌套函数

发布于 2024-12-10 18:42:37 字数 641 浏览 3 评论 0原文

我试图在多个单元格中使用一个公式来计算值,这取决于应用公式的特定行和列,但相对于行本身。听起来有点神秘,举个例子:

我有以下三行,
第 91 行:10|小麦|60,00|0,00
第 92 行:11|香蕉|91,20|1,00
第 93 行:12|牛奶|200,00|182,00

其中|表示每列之间的分隔,这些列以字母命名(就像 Excel 默认情况下那样)。因此,单元格 A92 的值将为 11。现在,使用以下公式生成 D 列:=((C92/100)*D11),基本上采用单元格 C92 的值 (91,20 )将其除以 100,然后乘以单元格 D11 中保存的任何值(与我在其中生成值的列相同,但使用 A 列中的值作为要相乘的值的参考) 经过)。

现在,由于我需要在许多行中使用这个公式,我基本上想要这样的东西: =VALUE(=CONCATENATE("D"; ROW();)/100)*CELL("address" )),但这不是一个有效的公式。换句话说:

  1. 获取单元格 D 的值+当前行号(例如第 9 行的 D9 等)
  2. 将此值除以 100
  3. 乘以当前列字母的值+当前行号(单元格 E69 处的 E69 等) )

我希望有人知道如何实现这一目标。

I am trying to use one single formula across multiple cells for calculating a value, dependent on the specific row and column of which the formula is applied, but relative to the row itself. Sounds a little cryptic, so an example:

I have the following three rows,
Row 91: 10|Wheat|60,00|0,00
Row 92: 11|Banana|91,20|1,00
Row 93: 12|Milk|200,00|182,00

Where the | represents a separation between each column, which are named by letter (as Excel does by default). So the value of cell A92 would be 11. Now, column D is generated using the following formula: =((C92/100)*D11), basically taking the value of cell C92 (91,20) dividing it by 100, and then multiplying it by whatever value is held in cell D11 (the same column as the one I am generating a value in, but using the value from column A for reference of what value to multiply by).

Now, seeing as I need to use this formula in many rows, I want to basically to something like this: =VALUE(=CONCATENATE("D"; ROW();)/100)*CELL("address")), but this is not a valid formula. To put it in words:

  1. Get the value of cell D+current row number (for example D9 at row 9 etc.)
  2. Divide this by 100
  3. Multiply this by the value of current column letter+current row number (E69 at cell E69 etc.)

I hope someone has an idea of how to achieve this.

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

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

发布评论

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

评论(2

长梦不多时 2024-12-17 18:42:37

您可以使用 OFFSET 来做到这一点,但如果您的数据不干净,您很可能会得到循环引用或错误。
<代码>
=(C92/100)*偏移量(D92,$A92-ROW(),0,1,1)

OFFSET 表示:获取 1 行 1 列范围的值,即(A92 中的值 - 当前行号)从该行偏移的行,但在当前列中),对于您的数据来说是 D11

You can do this with OFFSET, but you may very well get circular references or errors if your data is not clean.

=(C92/100)*OFFSET(D92,$A92-ROW(),0,1,1)

The OFFSET says: Get the value of a 1 row 1 column range that is (the value in A92 - current row number) rows offset from this row, but in the current column), which for your data is D11

回梦 2024-12-17 18:42:37

我认为这应该完成你的工作:

Sub Test()
    Cells(ActiveCell.Row, "D").FormulaR1C1 = "=RC" & ActiveCell.Column & "*RC3/100"
End Sub

I think this should do your job:

Sub Test()
    Cells(ActiveCell.Row, "D").FormulaR1C1 = "=RC" & ActiveCell.Column & "*RC3/100"
End Sub
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文