Search code examples
google-sheetsgoogle-sheets-formulasumifs

Google tabs IMPORTRANGE with SUMIF problems


I know it has already been a few times discussed topic, but I haven't found any help that would suit my problem yet. I'm trying to make a sum of numbers in one column in a different Google sheet. The problem is I need to sum only those numbers happened in chosen month. I have the number of the month in the sheet where I need the function, and I have the month specifikation in a column next to the numbers.

All I came to till now is this (after many totally different codes):

=sum(query(IMPORTRANGE("xyz";"Výkaz!B23:C125");"select Col2,Col3 where "col2=G4";0)"))
  • G4 is the chosen month I have in the same sheet as this code

Please, could you help me figure this out? Thank you


Solution

  • Google Sheet 1 (TabName = "externalTab")

    Google Sheet 2 (TabName = "InternalTab")

    Use importrange to pull the all data from "externalTab" to "Internal Tab". Then just use a sumifs formula to add up values based on your criteria.

    =IMPORTRANGE("https://docs.google.com/spreadsheets/d/1sLPGZkAVlxWfjhDMU9oa_cww0AI570Rtem0XCoOx0AE", "'externalTab '!A1:AF2000")
    

    Alternatively use the following formula. Integers to be summed are located in column a/Col1 and Months are located in column b/Col2. There is one header row on the spreadsheet and we are adding up all the Integers that correspond to the month June.

    =sum(query(importrange("https://docs.google.com/spreadsheets/d/1sLPGZkAVlxWfjhDMU9oa_cww0AI570Rtem0XCoOx0AE","a1:b1000"),"select Col1, Col2 WHERE Col2 = 'June'",1))