简体   繁体   English

让 SUMIFS 在具有多个条件的数组中工作,包括。 日期

[英]Getting SUMIFS to work in array with multiple criteria incl. date

I'm trying to get an automatic number of days delivered per consultant (see row F below) per month.我试图让每个顾问每月自动交付天数(见下面的 F 行)。 The Renewals Timeline worksheet (pictured below) shows the number of days delivered in each week.续订时间表工作表(如下图所示)显示每周交付的天数。

续订时间表工作表

However when I try in the CSM worksheet to use the following formula to total up the number of days delivered by the person named I get "VALUE."但是,当我尝试在 CSM 工作表中使用以下公式计算名为我的人交付的天数时,我得到“VALUE”。 error.错误。

=SUMIFS('Renewals Timeline'!$K5:$DJ51,'Renewals Timeline'!$F:$F,$C3,'Renewals Timeline'!$K4:$DJ4,">="&D$2,'Renewals Timeline'!$K4:$DJ4,"<="&E$2)

(Formula found in CSM Worksheet - pictured below) (在 CSM 工作表中找到的公式 - 如下图所示)

CSM 工作表

FYI the value found in CSM worksheet, cell D2 is 1/1/22, E2 is 1/2/22, etc.仅供参考,在 CSM 工作表中找到的值,单元格 D2 是 1/1/22,E2 是 1/2/22,等等。

EDIT:编辑:

It is now clear that I need to use a SUMPRODUCT function to get this to work, is anyone able to help me write one?现在很明显,我需要使用 SUMPRODUCT function 才能使其工作,有人能帮我写一个吗? Nothing I do will work.我做什么都行不通。

Try the following formula in cell CSM!D2在单元格 CSM!D2 中尝试以下公式

=SUM((DATE(YEAR('Renewals Timeline'!$K$4:$DJ$4),MONTH('Renewals Timeline'!$K$4:$DJ$4),1)=D$2)*('Renewals Timeline'!$F$5:$F$51=$C3)*('Renewals Timeline'!$K$5:$DJ$51))

The formula consists of 3 parts that are being multiplied and the result being summed up.该公式由 3 个部分组成,这些部分相乘并相加结果。

The first checks which of the dates in the 'Renewals Timeline' sheet is the same year and month as give in the CSM sheet:第一个检查“续订时间表”表中的哪些日期与 CSM 表中给出的年份和月份相同:

(DATE(YEAR('Renewals Timeline'!$K$4:$DJ$4),MONTH('Renewals Timeline'!$K$4:$DJ$4),1)=D$2)

The second checks which of the names in the 'Renewals Timeline' sheet is the same as the the one in the CSM sheet:第二个检查“续订时间表”表中的哪些名称与 CSM 表中的名称相同:

('Renewals Timeline'!$F$5:$F$51=$C3)

Since the first is a column vector and the second is a row vector, they create a matrix of 1s and 0s of the same size as the data matrix $K$5:$DJ$51 where the 1s are all the cells that are true for both criteria.由于第一个是列向量,第二个是行向量,因此它们创建了一个与数据矩阵 $K$5:$DJ$51 大小相同的 1 和 0 矩阵,其中 1 是对两者都为真的所有单元格标准。

The third part is simply the data matrix第三部分是简单的数据矩阵

('Renewals Timeline'!$K$5:$DJ$51)

After multiplication with the matrix of elements 1 and 2, it has only the true values remaining.在与元素 1 和 2 的矩阵相乘后,它只剩下真值。 Then the formula is summing those values up.然后公式将这些值相加。

Make sure to set the $ symbol for the criteria comparison as =D$2 and =$C3 so that you can simply drag the formula over all names and months in the CSM sheet.确保将标准比较的 $ 符号设置为 =D$2 和 =$C3,以便您可以简单地将公式拖到 CSM 表中的所有名称和月份上。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM