Google Excel中的求和列,使用2个条件

问题描述 投票:0回答:2

我在Google电子表格中有一个包含4列的表格[时间戳,项目,金额,类别],并希望获取属于特定月份和特定类别的所有行,并对金额列求和。

到目前为止,我已经尝试过

=QUERY(Sheet1!A:D,"SELECT SUM(C) WHERE MONTH(A) = 1 AND D = 'some text' GROUP BY A",1)

=IF(AND(EQ(Sheet1!D2:D,B17),MONTH(Sheet1!A2:A)=1),SUM(Sheet1!C2:C))

B17是我要进行比较的文本。

sql select google-sheets google-sheets-query
2个回答
0
投票
1.) I added new column as [month] of [timestamp] 
2.) You should use SUMIFS function

The syntax for the SUMIFS function in Microsoft Excel is:

SUMIFS( sum_range, criteria_range1, criteria1, [criteria_range2, criteria2, ... criteria_range_n, criteria_n] )

=SUMIFS(C2:C7;B2:B7;"Rubber";E2:E7;"=1")

[C] column corresponds [amount] column (which is sum range)
[B] column corresponds [category] column 
[E] column corresponds month of timestamp

0
投票

在Google电子表格中,尝试

© www.soinside.com 2019 - 2024. All rights reserved.