如何使用数组公式对Excel,3D数组中的列,行,列进行求和

蔚蓝

我正在Excel中建立排程工具。这包括具有开始和结束日期的任务列表,以及可以分配给每个任务的人员。

为了能够将这些数据输出到我们的预算系统中,我需要能够计算出给定月份内预定的员工时间百分比(所有任务的总和)。

我可以使用以下公式来计算工作人员在给定月份中在单个给定任务上可使用的时间:

=SUM(INDEX(WorkdayArrayMonCol,MATCH(B2,WorkdayArrayDateCol)):INDEX(WorkdayArrayFriCol,MATCH(C2,WorkdayArrayDateCol))*TRANSPOSE('Staff Profile'!$B$13:$B$17))

这对于单个任务非常有用,但是我需要在一系列任务中都可以使用的等效对象。

我的尝试目前看起来像这样:

=IFERROR(MMULT(MMULT(TRANSPOSE(ROW(INDEX(WorkdayArrayMonCol,MATCH(B2:B12,WorkdayArrayDateCol)):INDEX(WorkdayArrayFriCol,MATCH(C2:C12,WorkdayArrayDateCol)))^0),INDEX(WorkdayArrayMonCol,MATCH(B2:B12,WorkdayArrayDateCol)):INDEX(WorkdayArrayFriCol,MATCH(C2:C12,WorkdayArrayDateCol))),'Staff Profile'!$B$13:$B$17),0)

+ ctrl+ shift+enter

该公式使用索引/匹配来查找B2:B12 (task start date) and C2:C12 (task end date)

使用0 (0/01/1900)如果任务是当月的范围内进行。这些搜索表WorkdayArray

包含6列,分别是“日期”,“星期一”,“星期二...”到“星期五”,然后返回日期范围的2D数组,其中包含要累加每个工作日在该范围内的值的值。这对于准确地捕捉公众假期是必要的。

然后将此2D数组乘以员工的工作可用性,即,在处'Staff Profile'!$B$13:$B$17,这5个值中的每个值都是0> => 1,代表星期一至星期五。例如,如果他们在星期二工作半天,而在一周的其余时间工作了整天,则这5个单元格看起来像{1,0.5,1,1,1}

Using the technique posted here: How to use an array formula to return an array of sums in Excel I've managed to get it condensed down to a vector, but I can't get it to sum up the final total.

Using the formula above, the output is {8.5;4;2;2;0;0;0;0;0;0;1}, which is the available workdays for each task, however my attempts to sum this resulting data using the MMULT technique linked, SUMPRODUCT, SUM or SUMIF keep resulting in the same data being returned:{8.5;4;2;2;0;0;0;0;0;0;1}

Since this calculation is going to be repeated for each financial month (y), across each staff member (x) it's not feasible to do a 3D excel representation by using (z) sheets as each of x, y, & z are impractically large. I'd rather not use VBA, and I'm close enough it seems like it should be possible using formulas.

Thanks very much!

Edit: A one-sheet version re Zac's request (same formula, adjusted references):

Single sheet version:

.

I've selected 11 cells to illustrate the array result (what I want is the formula to output the sum of these values, 17.5).

barry houdini

I used a different approach to get the required result, i.e. this array formula:

=SUM(COUNTIFS(B2:B12,"<="&Table1[Date],C2:C12,">="&Table1[Date])*MMULT(Table1[[Monday]:[Friday]],P3:P7))

confirmed with CTRL+SHIFT+ENTER

The COUNTIFS part gives you a vertical vector representing how many times each date appears in the column B and C date ranges and then the MMULT part gives you another vertical vector with a value for each date based on the P3:P7 values

Those two vectors can then be multiplied and summed for the final result - 17.5 shown in P12

enter image description here

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

如何在Excel中的数组公式中按行求和?

在3D数组中添加列或行

Excel公式根据条件对数组公式中左侧列中的值求和

如何删除3D Numpy数组中的列

如何在Tensorflow中从3D数组中提取行和列

如何有效地从 3d numpy 数组中删除行和列?

如何通过在MATLAB中控制2D数组的列来创建3D数组?

使用 2D 和 3D 数组对数组中的值求和

如何在每行使用单个数组公式的同时求和当前列中的行?

从 3D numpy 数组中删除并附加中间列

在3D Numpy数组中克隆列

我如何使用INT公式平均excel中E列中的D行?

使用Google查询作为数组公式,根据另一列中的信息对一列中的值求和

excel公式对数组求和

数组求和数组的行和列

如何对有条件的numpy 3D数组中的值求和?

如何根据条件将中心列放入3d数组中?

如何使用基于3列的DAX公式“求和”?微软PowerBI

如何使用 Numpy 在 Python 中创建 3D 数组?

如何在3D Numpy数组中查找2D数组的行

使用numpy将2D数组中的第n列乘以3D数组中的第n个数组

如何获取 3D numpy 数组中除最后一列之外的所有列?

Javascript对3d嵌套数组中的内部数组求和

如何使用 2d 数组的值作为 numpy 中 3d 数组的索引?

如何仅使用VBA代码对2D数组中的数字列进行排名

“einsum”化 A 的每一列和 B 行的外积并存储在 3D 数组中

Excel:使用数组按行对乘积求和

从3D数组中删除与从3D数组中删除的行相对应的行

如何使用周围3D数组中的值填充numpy 3D数组(或火炬张量)