阵列,有点带有数组产品总和,有点生成新数组

发布于 2025-01-22 22:38:04 字数 808 浏览 2 评论 0原文

我有一个数据集(列:十个名称,name_j; j = 1至jmax = 10)。这是一个模型,每一行都显示了跨列的渐进变化,在行(时间)

下一行的计算取决于

下一行中每个j th单元格的尴尬计算:(

= the sum of these TEN products (n = 1-->nMax = jMax = 10)
     the product of:  
          a: the value from the n-th column in the prior row
               TIMES  
          b: a table lookup: (n th row of the J th column)

在书写中,我看到了如何看我会用每个单元格中的vba代码对此进行迭代

,我可以写出所有这些所有这些产品,一次为下一行中的每个单元格一次,但是看起来很尴尬且易于错误,乏味并且不容易修改以更改/扩展JMAX = NMAX 。

由于某种原因,我认为有一个dsum或数组公式计算或某些内容可以在每个单元格中完成此计算,而无需明确输入扩展计算。

以这种更好的方式,我可以在将来更改n列的数量(因此,查找表中的N行和J列的数量相同),

但是回到VBA:通过将迭代作为功能性而拼写更好参考,直接使用本机索引/查找。我将如何创建/呼叫/该功能参考。我假设(在每个单元格中)这样的东西,并在电子表格中定义了适当的范围(因此宏可以在电子表格最大/min,表格等上拉出。

= myNewMacro ( j, refToJMax, refToTable )

I have a data set (columns: ten names, name_J; j=1 to jMax=10). This is a model, each row shows the progressive changes across columns, over rows (time)

The calculation for the next row depends on an awkward calculation

For each J th cell in the next row:

= the sum of these TEN products (n = 1-->nMax = jMax = 10)
     the product of:  
          a: the value from the n-th column in the prior row
               TIMES  
          b: a table lookup: (n th row of the J th column)

(In writing this out, I m seeing how I would iterate this in VBA code)

In each cell, I could write out all these all products, once for each cell in the next row, but it seems awkward and error prone, tedious and not easily amended to change/expand jMax=nMax.

For some reason, I think there is a dsum or array formula calculation or something that accomplishes this calculation in each cell, without having to type out explicitly the extended calculation.

With that better way, I could change the number of N columns in the future (and therefore the identical number of n rows and j columns in the lookup table)

But going back to VBA: Is this better done by scripting the iteration as a functional reference, directly, rather than using native index/lookup. How would I create/call/that functional reference. I assume something like this (in each cell), with the appropriate ranges defined in the spreadsheet (so the macro could pull in the spreadsheet max/min, table names, etc.)

= myNewMacro ( j, refToJMax, refToTable )

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

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

发布评论

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

评论(1

决绝 2025-01-29 22:38:04

我对此功能进行了解决:

= sumproduct ( .... )

我仍然必须为每个单元格键入一个功能,但是编辑更简单,但没有考虑如何使用数组公式。

@Tim Williams, @user127480我认为使用函数找到此解决方案的问题使这个问题正如提出的那样,而不是一个值得的问题,因此我会考虑并编辑或删除问题。

谢谢

I ve settled down on this function:

= sumproduct ( .... )

I still have to type one function for each cell, but the editing was simpler, but haven't thought how to use array formula's.

@tim williams, @user127480 i think that finding this solution with function made this question, as posed, not a worthy question , so i will think on it and either edit or remove the question.

Thanks

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