1

I'm trying to query two separate sheets to a cell in my budget. One of the sheets is a google form I use to track my daily cash transactions, and the other is a ledger I'm using to input my bank transactions.

If I query either one of the sheets like this, either works fine:

=SUM(QUERY('Form Responses'!$A$1:$C$400,"SELECT B,C WHERE B = 'Coffee'",1))/$D$1
=SUM(QUERY(Ledger!$A$1:$C$400,"SELECT B,C WHERE B = 'Coffee'",1))/$D$1

HOWEVER, when I try to combine them like this...

=SUM(QUERY({'Form Responses'!$A$1:$C$400;Ledger!$A$1:$C$400},"SELECT B,C WHERE B = 'Coffee'",1))/$D$1

I get this error:

Unable to parse query string for Function QUERY parameter 2: NO_COLUMN: B

I have gone deep into forums and SO, and have found lots of tips - but none of them work and many of them are depreciated. Can anyone solve this issue at a glance?

I don't understand how there can be a 'Column B' when they're queried individually, but not when queried together.

2
  • 1
    When you use an array of data for query() - you should use Col1, Col2, etc., instead of A,B, etc. In your case "SELECT Col2, Col3 WHERE Col2 = 'Coffee'" should help. Commented Nov 10, 2021 at 6:36
  • Does this answer your question? Google spreadsheet Query Error - column doesn't exist Commented Nov 10, 2021 at 8:18

1 Answer 1

1

use:

=SUM(QUERY({'Form Responses'!$A$1:$C$400; Ledger!$A$1:$C$400},
 "select Col2,Col3 where Col2 = 'Coffee'", 1))/$D$1
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.