# Add cells based on the content of another column

I have this sheet and I am trying to add the values of June but the issue that I have is that these values will update often with so I need to find a formula that accounts for that. The other issue is that these values will live on different rows, so one instance might be 'B1' (14) but then it might be 'B3' (2) etc.

I think something with =COUNTIF("June",...) might work, but that's where I'm stuck. • Found the answer using this formula =SUM(FILTER(B:B,A:A="June")) -- Thanks to this video – フレヂィ Jul 7 '15 at 20:04

## 1 Answer

The solution, as I understand it, is as follows.

By setting a FILTER formula (array & condition) you create the first step, the "what are we looking for, specifically" then that formula gets wrapped in a SUM formula which adds the array values.

So, in the case above `=SUM(FILTER(B:B,A:A="June"))` this formula is looking for the values, all of them, in column B and then it filters the results if those values meet the criteria, in my case anything with June. Lastly, it adds those values. Here you can see the updated sheet with the formula in action.