简体   繁体   English

Excel和= sumproduct

[英]Excel and =sumproduct

I was making a sheet with excel and then I needed to apply sumproduct to sum the price multiplied by it quantity. 我用excel制作一张纸,然后我需要应用sumproduct来将价格乘以数量得出总和。 Then, I needed to find the sum of them BUT the red lines. 然后,我需要找到它们的总和,但要加上红线。 So what I've made: I put the full sumproduct (B:B;C:C) and then, subtracted every other sumproduct from the red lines. 所以我做了什么:我将完整的和积(B:B; C:C)放入,然后从红线中减去所有其他的和积。

My question is: is there any other way to make this function works? 我的问题是:还有其他方法可以使此功能起作用吗? Like, simplify this function? 喜欢,简化此功能? If so, how? 如果是这样,怎么办?

There's an image of my sheet here: 这里有我的工作表图片:

在此处输入图片说明

考虑:

=SUMPRODUCT(B:B,C:C)-B5*C5-B14*C14-B16*C16

您可以将红线上的数量更改为负,然后使用简单的公式:

=SUMPRODUCT(B:B, C:C)

You could start by calculating every price in D 您可以先计算D中的每个价格

  • put this code in D2: 将此代码放在D2中:

     =$B2*$C2 
  • Then select D2 and drag it down so the formula is copied down in the column. 然后选择D2并将其向下拖动,以便将公式向下复制到该列中。

I don't know the rule for something to be red. 我不知道变成红色的规则。 I pretended it was red if the price was higher then 15 for each piece. 我假装如果价格高于每件15则为红色。

So I filled in at F2: 所以我在F2处填写:

=SUMIF(C2:C16;"<15,00";D2:D16)

The "<15,00" means everything under 15 won't be counted, you can replace this with your own statement. “ <15,00”表示不计算15岁以下的所有内容,您可以用自己的语句替换。

And at F3: 在F3:

=SUM(D2:D16)

This is my result (withouth the red columns) 这是我的结果(没有红色的列)

http://prntscr.com/6060gb http://prntscr.com/6060gb

Maybe it helped you out, it's not easier, but i'm sure it works (I tested it) 也许它可以帮助您,但这并不容易,但是我敢肯定它可以工作(我已经测试过)

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

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