Search code examples
google-sheetsgroup-bysummatchgoogle-query-language

sum values which satisfy conditions in google sheets


I try to do a formulae which should check column A and if in cell value is 1 than formulae should take value in column B and sum with others which satisfy conditions

sheet example)) https://docs.google.com/spreadsheets/d/1hjP1-EgQYvKDOM6wYj_NmFiOXAsaAOAgaFGWf8feJxw/edit?usp=sharing


Solution

  • try:

    =ARRAYFORMULA(QUERY({A2:A&""\ B2:B}; 
     "select Col1,sum(Col2) where Col1 is not null 
      group by Col1 label sum(Col2)''"))
    

    enter image description here