简体   繁体   中英

Google Sheets ArrayFormula

Have 2 tables in 2 sheets, a 1 to many relationship between sheet1 and sheet2.

Need an ArrayFormula in sheet1 (one side) that sums sheet2.B for all sheet1.A = sheet2.A

I have a SUMIF that works individually eg: 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;

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 )

Edit2; link to a sample sheet 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))

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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