简体   繁体   English

在Excel中使用公式SUMIF()和WHEN()

[英]Using the Formula SUMIF() and WHEN() in Excel

I tried a Formula in Excel for the following condition. 我为以下情况在Excel中尝试了一个公式。 In the first line I have the month from January to March. 在第一行中,我是从一月到三月的月份。 All the values which are corresponding to the months are in the second line. 与月份对应的所有值都在第二行中。 I want to sum up these values. 我想总结这些价值。 For example the values from month January would be 30. 例如,一月份的值将为30。

I got it figured out up to this formula: =WENN(A1:J1;SUMMEWENN(A1:J1;MONAT(1);A2:J2)) . 我明白了这个公式: =WENN(A1:J1;SUMMEWENN(A1:J1;MONAT(1);A2:J2)) I am searching in the entire row for the month 1 ( January ) but when I copy this for Feb it does not work I get the same result. 我正在整行中搜索第1个月(一月),但是当我将其复制到Feb却无法正常工作时,会得到相同的结果。 By the way it is the German version :-) 顺便说一句,这是德文版:-)

表

thx all. 全部。

You need to freeze the range "A1:J1". 您需要冻结范围“ A1:J1”。 Use the below Code 使用以下代码

=WENN($A$1:$J$1;SUMMEWENN($A$1:$J$1;MONAT(1);$A$2:$J$2))

It looks like your top row is formatted as text. 看起来您的第一行已格式化为文本。 If that is the case then this might be a possible solution for you: 如果是这种情况,那么这可能是您可能的解决方案:

For January: =SUMMEWENN($A$1:$J$1,"01",$A$1:$J$1) which would yield 30 对于一月份: =SUMMEWENN($A$1:$J$1,"01",$A$1:$J$1)将产生30
For Feb: =SUMMEWENN($A$1:$J$1,"02",$A$1:$J$1) which would yield 17 2月: =SUMMEWENN($A$1:$J$1,"02",$A$1:$J$1)将产生17
For March: =SUMMEWENN($A$1:$J$1,"03",$A$1:$J$1) which would yield 26 对于三月: =SUMMEWENN($A$1:$J$1,"03",$A$1:$J$1)将产生26

Let me know if something is unclear. 让我知道是否有不清楚的地方。

EDIT: This second portion might be easier because you can put it in cell A5 then drag it down to cell A7. 编辑:这第二部分可能更容易,因为您可以将其放在单元格A5中,然后将其向下拖动到单元格A7中。

=SUMMEWENN($A$1:$J$1,MONAT(DATWERT(A5&"1")),$A$1:$J$1)

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

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