Excel Formula to SUMIF date falls in particular month

后端 未结 3 1389
谎友^
谎友^ 2020-11-30 06:11

I have excel data in following format.

Date        Amount

03-Jan-13   430.00 
25-Jan-13   96.00 
10-Jan-13   440.00 
28-Feb-13   72.10 
28-Feb-13   72.30
         


        
3条回答
  •  被撕碎了的回忆
    2020-11-30 06:48

    =SUMPRODUCT( (MONTH($A$2:$A$6)=1) * ($B$2:$B$6) )
    

    Explanation:

    • (MONTH($A$2:$A$6)=1) creates an array of 1 and 0, it's 1 when the month is january, thus in your example the returned array would be [1, 1, 1, 0, 0]

    • SUMPRODUCT first multiplies each value of the array created in the above step with values of the array ($B$2:$B$6), then it sums them. Hence in your example it does this: (1 * 430) + (1 * 96) + (1 * 440) + (0 * 72.10) + (0 * 72.30)

    This works also in OpenOffice and Google Spreadsheets

提交回复
热议问题