简体   繁体   English

如何在更多条件下使用 SUMPRODUCT 和 SMALL?

[英]How can I use SUMPRODUCT AND SMALL with further conditions?

I am using this formula to sum the 10 smallest values and all is well.我正在使用这个公式来总结 10 个最小值,一切都很好。

=SUMPRODUCT(SMALL(G:G;ROW(INDIRECT("1:10")))) =SUMPRODUCT(小(G:G;行(间接(“1:10”))))

But I would like to add a filter/condition: I only want to sum values the value in column B:B is "A" or "B".但我想添加一个过滤器/条件:我只想总结列 B:B 中的值是“A”或“B”。

This will work for you:这对你有用:

  • G1:G100/(B1:B100="B") return an array of numbers in column G: G while column B:B = "B", mismatched values will return an error. G1:G100/(B1:B100="B")返回 G 列中的数字数组:G 而列 B:B = "B",不匹配的值将返回错误。 so use aggregate to calculate their sum without ignoring the error , the result is a sum of 1 to 10所以使用aggregate计算它们的总和而不ignoring the error ,结果是 1 到 10 的总和

here's formula:这是公式:

=SUMPRODUCT(AGGREGATE(15,6,G1:G100/(B1:B100="B"),ROW(1:10)))

在此处输入图片说明

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

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