Search code examples
google-sheetsgoogle-sheets-formulaarray-formulasgoogle-sheets-querygoogle-query-language

Can I get month-year & total amount for a row with Multiple column?


I have a sheet with

Date|Amount   Date|Amount   Date|Amount ... 

columns and from that I would like to get Month-Year:Total amount if it can be done with some Google spreadsheet functions/script.

I already have tried with many functions including ArrayFormula, Query, Text, etc. But They might require a range of data while I have broken range and didn't find any functions helpful.

This is how I would like to have: enter image description here

Can it be done?


Solution

  • =ARRAYFORMULA(QUERY({TEXT({A:A;C:C;E:E;G:G}, "mmm - yyyy"), {B:B;D:D;F:F;H:H}}, 
     "select Col1,sum(Col2) where Col2 is not null group by Col1 label sum(Col2)''", 0))
    

    0