如果另一列中包含单词 'yes',则使用 google 工作表对行求和

sum rows if another column has the word 'yes' in it using google sheets

:) 我正在尝试学习 google 表格,有些事情我想做,但我不知道怎么做。

A   B
5   yes
3   no
    yes
2   yes
    yes
5   no
    no
3   no
    yes
    yes
3   yes
    no
    no
5   no

=SUM(A1:A14)

如您在此示例中所见,我有两列

A - 一个数字 B - 是或否

我在底部添加了 =SUM(A1:A14),它正确地对 A 列求和。

如果我只想对 B 列中具有 yes 的行求和 A 列怎么办?

我该怎么做?

谢谢!

=SUMIF(B:B,"yes",A:A)

如果您扩展到更多列,=SUMIFS() 将允许多个条件。

Documentation

尝试:

=SUM(QUERY(A:B; "select A where B='yes'"; 0))

或:

=SUM(FILTER(A:A; B:B="yes"))

或:

=INDEX(SUM(IF(B:B="yes"; A:A; )))