简体   繁体   English

Google表格ArrayFormula

[英]Google Sheets ArrayFormula

Have 2 tables in 2 sheets, a 1 to many relationship between sheet1 and sheet2. 在2张纸中有2张表,sheet1和sheet2之间是一对多的关系。

Need an ArrayFormula in sheet1 (one side) that sums sheet2.B for all sheet1.A = sheet2.A 在sheet1(一侧)中需要一个将所有sheet1.A = sheet2.A的sheet2.B相加的ArrayFormula

I have a SUMIF that works individually eg: sheet1.A3 我有一个单独工作的SUMIF,例如:sheet1.A3

Searching showed examples where the rows aligned. 搜索显示了行对齐的示例。 My case, matching records can be anywhere in the 'many' table. 我的情况是,匹配记录可以在“许多”表中的任何位置。

Or maybe I'm understanding this wrong? 也许我理解这是错误的?

Pointers please. 请指针。

EDIT1; EDIT1;

Sheet1: // one side of one to many relationship
    column A: key1, key2, key3, ...

Sheet2; // many side of one to many relationship
    column A: key1, key2, key1, key2, key2, key3, key1, ...
    column B : num1, num2, num3, num4, ...

In sheet1 cell B1 i need an ArrayFormula that sums sheet2.B for all matching keys ( eg: sheet1.B2 must contain sums for matchig sheet1 key "key2" from sheet2.A ) 在sheet1单元格B1中,我需要一个ArrayFormula,它为所有匹配的键求和sheet2.B(例如:sheet1.B2必须包含对sheet2.A的matchig sheet1键“ key2”的总和)

Edit2; EDIT2; link to a sample sheet https://docs.google.com/spreadsheets/d/1YXzOUJYTyPR3YGQgdi14tzXheSK40mkBzMGg_LJID4M/edit?usp=sharing 链接到样本表https://docs.google.com/spreadsheets/d/1YXzOUJYTyPR3YGQgdi14tzXheSK40mkBzMGg_LJID4M/edit?usp=sharing

我终于设法使用数组公式完成了-现在我得到了自动扩展:)

=ARRAYFORMULA(IFERROR(VLOOKUP(A1:A10,QUERY(Many!A1:B,"select A, sum(B) group by A label sum(B) ''"),2,FALSE),0))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM