阵列,有点带有数组产品总和,有点生成新数组
我有一个数据集(列:十个名称,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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我对此功能进行了解决:
我仍然必须为每个单元格键入一个功能,但是编辑更简单,但没有考虑如何使用数组公式。
@Tim Williams, @user127480我认为使用函数找到此解决方案的问题使这个问题正如提出的那样,而不是一个值得的问题,因此我会考虑并编辑或删除问题。
谢谢
I ve settled down on this function:
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