2016-02-17 225 views
0

我有一個表在Excel中:EXCEL,總結不同產品的數量,其中月份是一月

Date    Product   Quantity 

1/4/2016    A    3 

1/4/2016    B    2 

1/8/2016    A    7 

2/3/2016    B    5 

2/5/2016    B    1 

2/8/2016    A    4 

我需要計算多少一個產品一月(無論是一天,正好一個月)被出售,FE:

A in January was sold 10, 
B in January was sold 2, 
A in February was sold 4 
B in Feruary was sold 9 

回答

1

你可以使用SUMPRODUCT,例如:

=SUMPRODUCT(--(MONTH(A1:A2)=1) * (B1:B2="A") * C1:C2) 

在上面我假設日期是在A列,產品要在B列和範圍要在C.還總結,因爲它只是一個例子,我只是前兩行相加

我引用SO發佈here

1

您還可以使用SUMIFS: -

=SUMIFS(C:C,B:B,"A",A:A,">="&DATEVALUE("1/1/2016"),A:A,"<"&DATEVALUE("1/2/2016")) 

=SUMIFS(C:C,B:B,"A",A:A,">="&DATE(2016,1,1),A:A,"<"&DATE(2016,2,1)) 

在我的日期是在DD/MM/YYYY格式。

但是,如果您想重複使用日期和產品的多種組合,最好將月份放入單獨的列並使用數據透視表。

相關問題