Google-sheets – Issue trying to sum different columns

formulasgoogle sheetsgoogle-sheets-arrayformulagoogle-sheets-query

I am trying to sum 3 different columns and I'm not being successful.

My function is: =ARRAYFORMULA(SUMIF(MONTH(D:D), 2, A:C))

Where D is a column with dates, and A,B and C columns with currency (A-value, B-shipping and C-tip). So my idea is to sum the values I got just for the month of February.

The function works but it seems to be just summing the column A and not the other two. Does anybody know how can I make it sum all 3 columns?

Here's my demo sheet: https://docs.google.com/spreadsheets/d/1XuBAj1MJFZvxHd-doxgjB30uzAIj_c1v01GYDzxG_SI/edit?usp=sharing

Best Answer

Since you want to return the sum of each of 3 columns you could use the following query formula instead

=QUERY(QUERY(A:D, 
               "select sum(A), sum(B), sum(C) where month(D)+1=2 ",1), 
         "select * OFFSET 1 ",0)

The above formula will give you results for just the month of February.

You can alter the formula to get results for each month

=QUERY(QUERY(A:D, 
               "select sum(A), sum(B), sum(C) group by month(D) ",1), 
         "select * OFFSET 2 ",0)

Google sheets double query by month of date using offset to hide labels

Functions used: