Mar 12, 2023
How can I combine multiple IMPORTRANGE with QUERY to SUM data from another spreadsheet?
After lots of trial and error, I finally landed on the following:
- Using QUERY to aggregate the data
- Using two IMPORTRANGE functions to split the data from the workbook up, after getting an error that using one IMPORTRANGE was too large
- Using the query "select sum(Col13) where Col1 like '%"&A2&"%' label sum(Col13) ''" to sum my costs column whenever there are matching unique identifiers (CID) in column A of the original workbook and column A (Col1) of the new workbook
Here's the full formula:
=QUERY({importrange("https://docs.google.com/spreadsheets/d/1tEY3yR2Ch6ntZbRh7rGUFBwor6HvYpIu4vnzi8JCxz8/edit?usp=sharing","Facebook!A:L");importrange("https://docs.google.com/spreadsheets/d/1tEY3yR2Ch6ntZbRh7rGUFBwor6HvYpIu4vnzi8JCxz8/edit?usp=sharing","Facebook!M:V")},"select sum(Col13) where Col1 like '%"&A2&"%' label sum(Col13) ''",1)/(1-24%)
Unfortunately, I'm getting an error: "Unable to parse query string for Function QUERY parameter 2: NO_COLUMN: Col13"
Here's a copy of the new workbork for reference: https://docs.google.com/spreadsheets/d/1tEY3yR2Ch6ntZbRh7rGUFBwor6HvYpIu4vnzi8JCxz8/edit?usp=sharing
Community content may not be verified or up-to-date. Learn more.
All Replies