Khom Nazid
Khom Nazid

Reputation: 630

SUMIF in Google Sheets for a month and if a column contains text

I have some simple data in the following format:

enter image description here

I need to make a sum of the last column, but based on the text in Domain column. The resulting table should be like this...given the text filtering needed, I'm not using pivot tables.

enter image description here

To do this, for July Domain 1 for example, I have a formula like this:

=SUMIFS(C:C, MONTH(A:A), 7, B:B, "domain1.") 

And for the rest of the domains:

=SUMIFS(C:C, MONTH(A:A), 7, B:B, "<>domain1.") 

I am using SUMIFS because I need the multiple conditionals. But this formula above gives an error:

Error: Array arguments to SUMIFS are of different size.

The columns are all structured as A:A, B:B, etc. What is going wrong?

Thanks.

Upvotes: 2

Views: 1490

Answers (1)

player0
player0

Reputation: 1

MONTH(A:A)

will output only one cell unless you wrap your formula into INDEX or ARRAYFORMULA:

=INDEX(SUMIFS(C:C, MONTH(A:A), 7, B:B, "<>domain1.*"))

enter image description here



=ARRAYFORMULA(QUERY({TEXT(A2:A, "mmmm"), B2:C}, 
 "select Col1,sum(Col3) 
  where not Col2 contains 'domain1.' 
    and Col3 is not null 
  group by Col1 
  label sum(Col3)''"))

0

Upvotes: 3

Related Questions