4

I use the following formula in my Google Spreadsheet:

QUERY(Inkomster!A2:G;"SELECT SUM(C) WHERE G="&B3&" AND F='"&A3&"'")

This returns the following (On two different rows that is)

H1=sum
H2=3720

I don't want the result of the query to return two rows, I'm not interested in the first row. Just the second one. How can I accomplish that?

migrated from superuser.com Jan 26 '13 at 19:57

This question came from our site for computer enthusiasts and power users.

  • Your line of code is impossible to interpret without know what cells B3 and A3 are. – James Mertz Jan 15 '13 at 19:27
  • Can you give me some feedback on the answer I gave you? Did it work? – Jacob Jan Tuinstra Jan 30 '13 at 17:28
  • Sorry about that. I tried it know and it did indeed work. However i'd already solved it using query without Sum, and then encapsulate the query method with sum(). – Anton Gildebrand Jan 30 '13 at 17:59
8

You can use the following formula for that:

INDEX(QUERY(Inkomster!A2:G;"SELECT SUM(C) WHERE G="&B3&" AND F='"&A3&"'"),2,0)

The 2 references the row number and the 0 or 1 references the column number

1

It looks like the original poster was just looking to get rid of the "sum" header. The easiest way to do this is:

=QUERY(Inkomster!A2:G;"SELECT SUM(C) WHERE G="&B3&" AND F='"&A3&"' label SUM(C)''")

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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