2

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

2
  • Welcome. Please read how to and share a test sheet so as you can be easier helped. Commented Mar 21, 2020 at 4:09
  • Thanks, just edited
    – João Vaz
    Commented Mar 21, 2020 at 17:31

1 Answer 1

1

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:

4
  • Hi marikamitsos, thank you so much for your reply! But my idea is to sum all values in one. Just in one cell and not in three different ones. Do you know how?
    – João Vaz
    Commented Mar 24, 2020 at 15:38
  • "my idea is to sum all values in one. Just in one cell and not in three different ones."??? Maybe I am missing something. So you want G2+H2+I2? If so, just wrap the formula with SUM. eg: =sum(QUERY(QUERY(A:D,"select sum(A), sum(B), sum(C) where month(D)+1=2 ",1), "select * OFFSET 1 ",0)). If it is something else please update the sheet with cells with the expected results. Commented Mar 24, 2020 at 19:37
  • oh of course, that's exactly what I wanted. Thank you once again!
    – João Vaz
    Commented Mar 25, 2020 at 15:18
  • Glad I could help. Please remember that as per site guidelines when an answer addresses your question, accept it and even upvote it so others can benefit as well. Commented Mar 31, 2020 at 21:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.