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

Google Sheets combine two sheets merging duplicates


I have two sheets with column 1 having different materials, but column 2 has their quantities. I need to combine both of the sheets, such as the duplicate material entries would be summed together. Is it possible to do in Google Sheets, possibly with the query function?


Solution

  • try it like this:

    =ARRAYFORMULA(QUERY({Sheet1!A1:B; Sheet2!A1:B}, 
     "select Col1,sum(Col2) 
      where Col2 is not null 
      group by Col1 
      label sum(Col2)''", 0))
    

    where column A = material and column B = quantity