我知道这个话题已经被讨论过几次了,但我还没有找到任何适合我的问题的帮助。 我正在尝试对另一张 Google 工作表中的一列中的数字进行求和。问题是我只需要对所选月份发生的那些数字进行求和。我在工作表中列出了需要该函数的月份编号,并且在数字旁边的列中列出了月份规格。
到目前为止我所想到的就是这个(在许多完全不同的代码之后):
=sum(query(IMPORTRANGE("xyz";"Výkaz!B23:C125");"select Col2,Col3 where "col2=G4";0)"))
请问您能帮我解决这个问题吗?谢谢你
Google 表 1(选项卡名称 =“externalTab”)
Google Sheet 2(选项卡名称=“InternalTab”)
使用 importrange 将所有数据从“externalTab”拉取到“Internal Tab”。然后只需使用 sumifs 公式根据您的标准将值相加即可。
=IMPORTRANGE("https://docs.google.com/spreadsheets/d/1sLPGZkAVlxWfjhDMU9oa_cww0AI570Rtem0XCoOx0AE", "'externalTab '!A1:AF2000")
或者使用以下公式。要求和的整数位于 a/Col1 列中,月份位于 b/Col2 列中。电子表格上有一个标题行,我们正在将与 6 月相对应的所有整数相加。
=sum(query(importrange("https://docs.google.com/spreadsheets/d/1sLPGZkAVlxWfjhDMU9oa_cww0AI570Rtem0XCoOx0AE","a1:b1000"),"select Col1, Col2 WHERE Col2 = 'June'",1))
您还可以做的是结合过滤器和导入范围。
假设您有一张包含三列的表格。我们称之为“内部表”
内表
Column a = YearMonth (eg. 202401, 202402,...), the data of the first column is already in your internal table.
Column b = Region (eg. North, East,...), the data of this second column is also already in your internal table.
Column c = Sales (!!These values needs to be imported by importrange from another, external spreadsheet External Table!!)
现在假设您有另一个表外部表,您要将数据导入到内部表的 c 列中。
外部表
外部表如下所示
Column a = Sales
Column b = YearMonth
Column c = Region
要从外部表导入销售额总和,并根据内部表按 YearMonth 和 Region 进行筛选,您可以将以下公式写入内部表的 c 列:
=SUM(filter(importrange("URL of the external spreadsheet that contains the data to be filtered ","Name of the external tab that contains the values for Sales used to build the sum , followed by the range of this specific column that contains the values!A1:A1000"),
(importrange("[The second importrange command defines the area where you want to filer, so again the URL of the external spreadsheet that contains the data to be filtered]","[Again the Name of the external tab that contains the data with the second column that you want to filter]!B1:B1000")=B2"YearMonth of internal table"),
(importrange("The third importrange command defines the area where you want to filer, so again the URL of the external spreadsheet that contains the data to be filtered","Again the Name of the external tab that contains the data with the second column that you want to filter!C1:C1000")=B3"Region of internal table")))
复制粘贴公式时,请将三个部分连接在一起并擦除它们之间的空格。为了更好理解,我把它们分开了