Still a noob in Google Sheets. I am trying to create a sheet with the statistics with the data coming from Sales sheet . I want to sum the quantity of all items sold according to sizes. For ex. How many SHP-PUR in 4XL, (in S, M, and L) sizes are sold?

I used this code but after verifying the result, it's wrong. It just counted the number of instances of an item in ITEM CODE and did not counted the sizes per item as I intend to do.

This is where the data is to be pulled. QTY is quantity sold


1 Answer 1


Try a query() formula like this:

=query(Sales!A2:C, "select A, B, sum(C) where A is not null group by A, B", 1)

  • I tried the same formula but didn't work either. It has #VALUE error with a lot of error description. Jun 6, 2021 at 4:12
  • Edited the answer to match the actual location of the date table. Jun 6, 2021 at 4:47
  • Sorry for the delay, may laptop crashed so bad and had to reformat. Your formula worked flawlessly! I spent almost a day searching in google but can't find the exact formula. It's s good thing that I found StackExchange, getting the right answer in jiffy from experts. Thank you very much! Cheers! Jun 7, 2021 at 3:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.