3 of 5
added 98 characters in body; edited tags
AToad
  • 15
  • 6

Is there a way to make a query with an importrange to mimic a sumif formula from another google sheet?

I am encountering a capacity issue with one of my spreadsheets but certain information in the sheet still need to be available to cross-reference. The original spreadsheet contains this formula:

=sumif(A:A,A2,N:N)=O2

I tried to do a direct transfer to the new spreadsheet by adding importranges like this:

=SUMIF(IMPORTRANGE("URL","Sheet1!A2:A"),IMPORTRANGE("URL","Sheet1!A2"),IMPORTRANGE("URL","Sheet1!N2:N")=IMPORTRANGE("URL","Sheet1!O2")

The equation keeps putting out an error saying "argument must be a range". Then I tried to write it out as a query like this:

=QUERY(AND(IMPORTRANGE("URL","Sheet1!A:A"),IMPORTRANGE("URL","Sheet1!N:N"),"SELECT SUM(CASE WHEN Col1=A2 THEN Col14)=O2"))

But the equation is showing FALSE as the result when it should say TRUE. I have attached an example spreadsheet so that these equations make more sense.

I also need the equation to take into account any new information that is placed on the new spreadsheet while also comparing it with the old info. I tried doing this to start with but then slowly realized the initial equation itself doesn't work.

=SUMIF(IMPORTRANGE("URL","Sheet1!A2:A"),IMPORTRANGE("URL","Sheet1!A2"),IMPORTRANGE("URL","Sheet1!N2:N"))=IMPORTRANGE("URL","Sheet1!O2")+SUMIF(A:A,A2,N:N)=O2

Any help is appreciated. Thank you in advance!

https://docs.google.com/spreadsheets/d/1q1cWh58p23dcQulQ4rz6v4iiDywEFHvcrvASao61xxo/edit#gid=0

AToad
  • 15
  • 6