0
votes

Im not sure where I am making a mistake here. In the following sheet

https://docs.google.com/spreadsheets/d/1h0XR399z6OHqzyX509WwnLBiqHX4nq4FmofaJd-HoAw/edit?usp=sharing

Sheet 1 has the raw data. I am trying to sum the same in sheet based on different criteria but I am getting an issue with a simple query. In sheet order_payment_heads a simple sum query in C2 returns the su but also the text sum amount. Feels like I am doing something really basic wrong here but any help would be great. query being used is given below

'''=QUERY(Sheet1!A:X,"select SUM(O) where H = '"&A2&"'",1)'''

1

1 Answers

1
votes

in a brand new tab, try this in cell A1

=QUERY(Sheet1!A:X,"select H,V,SUM(O) where H is not null group by H,V label SUM(O)'Price Head'")

Hopefully that will get what you're after in one go. "group by" is really the only reason that query distinguishes itself from other functions.