Search code examples
google-sheetssumrangearray-formulassumifs

SUMIF with Range (From this date to this date) as Criteria (Array Formula)


Hi guys so I am having trouble with making SUMIF ArrayFormula to SUM a set of data within a desired date range (from a certain date to another certain date) and with other criteria as well.

This is the sample case:

https://docs.google.com/spreadsheets/d/1EmmoTVHNR9RUO2xQsrNabNefYbP8ydLmy4ldrMMW63U/edit#gid=0

So, the data set can be seen in column A, B, and C. I want to SUM value in column B based on the category in column C, and based on the the date in column A. However problem arises when the date that I want to specify is a range.

The expected result is in column I, for instance in column I1 returns a total number from column B which column C contains "a" and column A contains date no bigger than 5 Jan and no less than 1 Jan. I also give my "wrong" formula in column H that I thought could be working, but not.

Is there any possible array formula (so that I don't need to drag over and over again when the data in column E until G is added down) that works on this case?


Solution

  • You may try:

    =map(E2:E,F2:F,G2:G,lambda(e,f,g,if(counta(e,f,g)<>3,,sumifs(B:B,C:C,e,A:A,">="&f,A:A,"<="&g))))
    

    enter image description here