80

I have the following data in a Google Spreadsheet:

+------+---------+
| Time | Include |
+------+---------+
| 0:30 | No      |
| 1:00 | Yes     |
| 0:30 | Yes     |
| 0:30 | No      |
| 0:30 | Yes     |
+------+---------+

I would like to add up the time where the column to the right is "Yes".

I am using the following to add up all time (3:00):

=SUM(A1:A5)

and I've tried the following to add up the time (2:00) where the adjacent column is Yes, but Google reports "#ERROR!":

=SUM(FILTER(A1:A5;B1:B5="Yes"))
xylar
  • 1,915
  • 1
  • 14
  • 12

2 Answers2

93

Just realised FILTER should be comma separated:

=SUM(FILTER(A1:A5,B1:B5="Yes"))
xylar
  • 1,915
  • 1
  • 14
  • 12
35

There is also a builtin function in Google Spreadsheet for this. That is SUMIF

Using SUMIF the solution would be like this:

=SUMIF(B1:B6,"Yes",A1:A6)
kuttumiah
  • 451
  • 5
  • 5