Google 用于计算一列中与另一列中的多列匹配的值总和的工作表公式 sheet

Google Sheets formula to calculate sum of values in one column which match multiple columns in another sheet

我需要 Sheet 2 列 D 中的公式,它将查找 Sheet 1 列 A 中 B 列和 C 列的值,并计算 C 列中值的总和。所以例如,D2 将 return 36.

Sheet 1:

Sheet 2

=ARRAYFORMULA(IFERROR(VLOOKUP(A2:A, QUERY({Sheet1!B:C}, 
 "select Col1, sum(Col2) where Col1 != '' group by Col1", 0), 2, 0)))