简体   繁体   English

Excel公式SUMPRODUCT

[英]Excel Formula SUMPRODUCT

Can anyone explain the meaning of the following formula? 谁能解释以下公式的含义?

Summary is an Excel tab name, and forecast Submit is also an excel tab name. Summary是Excel选项卡的名称,而“ forecast Submit也是Excel选项卡的名称。

=SUMPRODUCT(--(A85=Summary!$A$2:$A$144),'forecast Submit'!$C$2:$C$144)

Let's see if we can break this down for you: 让我们看看是否可以为您分解一下:

Summary!$A$2:$A$144

This notation means column A, rows 2-144, within the sheet Summary . 该符号表示工作表Summary A列,第2-144行。 You can ignore the dollar signs ( $ ) for now, because they're not actually changing your output. 您现在可以忽略美元符号( $ ),因为它们实际上并没有改变您的输出。 At this point, you have a series of values, all in column A . 此时,您在A列中都有一系列值。

A85=Summary!$A$2:$A$144

This compares each item in Summary!A2:A144 to the item in A85 , and reports true if they are equal. 这会将Summary!A2:A144中的每个项目与A85的项目进行比较,如果相等则报告为true。 At this point, you have a series of TRUE and FALSE values, and you can imagine that they are sitting in some invisible new (temporary) column, somewhere off to the side. 此时,您具有一系列TRUEFALSE值,并且可以想象它们位于某个不可见的新(临时)列中,位于侧面。

--()

This converts boolean (true/false) values to 1 s and 0 s. 这会将布尔值(真/假)转换为1 s和0 s。 A value of TRUE becomes 1 and a value of FALSE becomes 0 . TRUE变为1 ,值FALSE变为0

So now, our invisible column is filled with 1 s and 0 s. 因此,现在,我们的不可见列填充为1 s和0 s。

(sumproduct...) multiplies numbers in corresponding rows, and then sums the results. (sumproduct...)将相应行中的数字相乘,然后对结果求和。 In practice, you are now multiplying values by 1 or 0, and summing the result. 实际上,您现在将值乘以1或0,然后将结果相加。 Of course, anything multiplied by 0 is 0, and anything multiplied by 1 is itself. 当然,任何乘以0的值都是0,而任何乘以1的值本身都是。 So, in effect, the 0s you generated earlier are being used to ignore certain rows, and the 1s are being used to include the other rows. 因此,实际上,您先前生成的0被用于忽略某些行,而1被用于包括其他行。

Overall, it will add all of the numbers in forecast Submit for which the corresponding row in Summary is equal to A85 . 总体而言,它将在“ forecast Submit添加所有数字,“ Summary的对应行等于A85

https://exceljet.net/excel-functions/excel-sumproduct-function https://exceljet.net/excel-functions/excel-sumproduct-function

This should give you all the answers that you seek. 这应该为您提供所有想要的答案。

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

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