Google-sheets – Add cells based on the content of another column

formulasgoogle sheets

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.

enter image description here

Best 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.