Search code examples
google-sheetssumgoogle-sheets-formulasumifsgoogle-query-language

SUMIF the row can be found on another sheet


In my head this seems very simple but I for some reason I can't figure it out.

I have a list of lumber at a job site and I am wanting to add all the boards together that are the same size and length. I want to search "Lumber List w/o Duplicates" tab and see how many boards I have in total of that exact size.

For example I would think the formula would be: =SUMIF(A1:D1,'Lumber List'!A:D,'Lumber List'!E:E)

Here is the spreadsheet I am working on. https://docs.google.com/spreadsheets/d/1ocGFAeZDlsgaBR5K5gAisymBNaWQxrVDNnsyvtBcbB4/edit?usp=sharing

Any help would be great, and thank you so much in advance! :)


Solution

  • use:

    =QUERY('Lumber List'!A:E, 
     "select A,B,C,D,sum(E) 
      where A is not null 
      group by A,B,C,D 
      order by sum(E) desc 
      label sum(E)''")