1

I made two queries(using =QUERY) to a range of data in google sheets with the results as per the image below

enter image description here

I would like to:

  1. subtract the values of the right/smaller table from the left/bigger table according to the matching column entries (B,GBP)
  2. add the column entry(ies) of the right/smaller table that are missing from the left/bigger table

with the desired result looking like :

enter image description here

1
  • Please share a link to a copy of such a sample spreadsheet, with the link's Share permission set to "Anyone with the link... Editor." Otherwise, you're asking the volunteers here to manually type in all of your information in their own sheet before even beginning to work out a solution.
    – Erik Tyler
    Jan 2, 2021 at 22:50

1 Answer 1

2

Try this:

=query({query(A2:B7);query({D2:E5},"select Col1, -1*Col2 label -1*Col2 ''")}, "select Col1,Sum(Col2) group by Col1 Label Sum(Col2) 'Sum'")


Snapshot3

0

Your Answer

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

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