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

sum SQL in google sheet query function doesn't add


I have been working on a sheet for a while and I would like to use the query function of google sheet for adding the amount of the ingredients of different meals, to create an 'overall' shopping list, but it seems to be that the numbers are not added together.

I have created an example sheet of the problem to spare you from the unrelevant details, here is the link for that: https://docs.google.com/spreadsheets/d/1BHhs9XG5kX-o8pR27L64qAQ08c93bAy1g3YKNI073vY/edit?usp=sharing

Can you help me what I am missing?


Solution

  • use:

    =QUERY(A1:C8; "select A,sum(B),C where A is not null group by A,C"; 1)
    

    enter image description here