1

I have some data as follow (column A:D contain data, column E is the sum I created):

NO              
SE  

Date        Country ID  Value   Sum
30-01-2014  SE  B-08888 10  10  
05-02-2014  SE  B-08888 23      
06-02-2014  SE  B-08888 20      
13-05-2014  SE  B-08888 17  27  
14-05-2014  SE  B-08888 10      
13-05-2014  NO  A-07777 15  35  
14-05-2014  NO  A-07777 20      

I would like to sum all values that are having same country and same ID when: 1) the date is greater than 1/5; and 2) when date is less than 1/5.

I am using the SUMIFS. But the SUMIFS doesn't give correct results when I included the date argument which is less than 1/5.

=SUMIFS($D$5:$D$11;$A$5:$A$11;"<="&DATE(2014;5;1);$B$5:$B$11;A2;$C$5:$C$11;C5) ==> gives incorrect result (=10)

=SUMIFS($D$5:$D$11;$A$5:$A$11;">="&DATE(2014;5;1);$B$5:$B$11;A2;$C$5:$C$11;C8) ==> gives correct result (=27)

Is there a way I can take into account both date conditions (i.e. date greater than and less than 1/5) and make the formula general so I don't have to go through every cell to change reference?

Thank you.

4

1 回答 1

0

使用您的数据,第二个公式27为我返回 - 所以我假设您没有提到的单元格引用正如我所猜测的那样。我的第一个公式返回53- 我怀疑你想要的结果,虽然没有提到。

您的数据有问题(不是公式)。最可能的原因是 C6 和 C7 中有一个尾随空格,而 C5 中没有。将 C5 复制到 C9 应该可以解决这个问题。但是,这两行中的其他单元格中可能存在数据问题。

如果公式在不同的列中,它可能会使您的事情变得更容易。

于 2014-09-17T20:02:21.823 回答